clear all; %jf. oppg. 5.7.4

A=[-2 -5; 1 4]

[V,D] = eig(A)     

d1 = D(1,1);
d2 = D(2,2);

y1 = []; y2 = [];

for t=-0.52:0.05:0.27;

y1 = [ y1 V(:,1)*exp(d1*t) ];

y2 = [ y2 V(:,2)*exp(d2*t) ];

end

P=[V(:,1) V(:,2)]; c=P\[3;2]

x=c(1)*y1+c(2)*y2;

figure(2)
plot(x(1,:),x(2,:),'r');
hold on

r=-3.5:0.5:10;
s=-2.5:0.5:5.5; 

[x,y]=meshgrid(r,s);
u = -2*x-5*y;
v =  x+4*y; 
quiver(x,y,u,v);

