A=[3 1; -2 1]

[U,D] = eig(A)      
% A har komplekse egenverdier med positiv realdel


a = real(D(1,1));
b = imag(D(1,1));

y1 = []; y2 = [];

for t=-pi/2:0.05:pi/2;

y1 = [ y1 (real(U(:,1))*cos(b*t) - imag(U(:,1))*sin(b*t))*exp(a*t) ];

y2 = [ y2 (real(U(:,1))*sin(b*t) + imag(U(:,1))*cos(b*t))*exp(a*t) ];

end

figure(8)
hold on;

axis([-10 10 -1 20])
plot(y1(1,:),y1(2,:),'g');
plot(y2(1,:),y2(2,:),'r');


r=-10:1:10;
s=-1:1:20;

[x,y]=meshgrid(r,s);

u =  3*x + y;
v = -2*x + y;

quiver(x,y,u,v);

