A=[0.5 1; -1 0]

[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=-10:0.05:10;

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(1)
%axis([-3 6 -10 4])
%plot(y1(1,:),y1(2,:),'g');

%figure(2)
%axis([-3 6 -10 4])
%plot(y2(1,:),y2(2,:),'r');

figure(5)
hold on;

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


r=-3:0.4:6;
s=-10:0.4:4;

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

u = 0.5 * x + y;
v = - x;

quiver(x,y,u,v);

