% Phase portrait by the A matrix of Linear System
% Tunnel-Diode Circuit
% 

clear all; close all;

Q1 = [ 0.063, 0.758 ];
Q2 = [ 0.285, 0.61 ];
Q3 = [ 0.884, 0.21 ];

AQ1 = [ -3.598, 0.5; -0.2, -0.3];
AQ2 = [ 1.82, 0.5; -0.2, -0.3];
AQ3 = [ -1.427, 0.5; -0.2, -0.3];

[V1, D1] = eig(AQ1);
[V2, D2] = eig(AQ2);
[V3, D3] = eig(AQ3);


figure(11)

plot( Q1(1), Q1(2), 'xr' ); hold on;
plot( Q2(1), Q2(2), 'ob' );
plot( Q3(1), Q3(2), 'sg' );

line( [ -0.4, 1.6], [ 0 0 ], 'Color', 'k' );
line( [ 0 0 ], [ -0.4, 1.6], 'Color', 'k' );

Q = Q1; V = V1/10;
line( [Q(1) - V(1,1), Q(1) + 2*V(1,1)], [Q(2) - V(2,1), Q(2) + 2*V(2,1)], 'Color', 'r' );
line( [Q(1) - V(1,2), Q(1) + 2*V(1,2)], [Q(2) - V(2,2), Q(2) + 2*V(2,2)], 'Color', 'b' );

Q = Q2; V = V2/10;
line( [Q(1) - V(1,1), Q(1) + 2*V(1,1)], [Q(2) - V(2,1), Q(2) + 2*V(2,1)], 'Color', 'r' );
line( [Q(1) - V(1,2), Q(1) + 2*V(1,2)], [Q(2) - V(2,2), Q(2) + 2*V(2,2)], 'Color', 'b' );

Q = Q3; V = V3/10;
line( [Q(1) - V(1,1), Q(1) + 2*V(1,1)], [Q(2) - V(2,1), Q(2) + 2*V(2,1)], 'Color', 'r' );
line( [Q(1) - V(1,2), Q(1) + 2*V(1,2)], [Q(2) - V(2,2), Q(2) + 2*V(2,2)], 'Color', 'b' );


axis( [ -0.4, 1.6, -0.4, 1.6 ] );