clear all; %Jf. oppg. 5.7.6

A=[1 -2; 3 -4]

[V,D] = eig(A)     

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

y1 = []; y2 = [];

for t=-0.8:0.05:5;

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(4)
plot(x(1,:),x(2,:),'r');
hold on

r=0:0.5:4;
s=-4:0.5:3; 

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

