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

clear all; close all;

Q1 = [ 0, 0 ];
Q2 = [ pi, 0 ];
Q3 = [ -pi, 0 ];

AQ1 = [ 0, 1; -10, -1];
AQ2 = [ 0, 1; 10, 1];
AQ3 = [ 0, 1; 10, 1];

[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( [ -6, 6], [ 0 0 ], 'Color', 'k' );
line( [ 0 0 ], [ -6, 6], 'Color', 'k' );

Q = Q1; V = V1/1;
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/1;
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/1;
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( [ -6, 6, -6, 6 ] );