

clear all

A=[-0.1 10;0 -0.2];

PH=linspace(0,2*pi,181);c=cos(PH);s=sin(PH);
for ia=1:100

th=pi*rand(1);

x0=[cos(th);sin(th)];

figure(1)
plot(c,s,'b',x0(1),x0(2),'*r','Markersize',7)
axis('equal')
hold on

dt=0.1;
Nt=200;

tt=zeros(Nt,1);Et=ones(Nt,1);

AE=expm(A*dt);
xt=x0;
for it=2:Nt;
    tt(it)=(it-1)*dt;
    xt=AE*xt;
    Et(it)=(norm(xt))^2;
end;

figure(45)
plot(tt,Et,'k','Linewidth',2)
xlabel('$t$','Interpreter','latex','Fontsize',24);
ylabel('$E(t)$','Interpreter','latex','Fontsize',24);
hold on
 figure(46)
semilogy(tt,Et,'k',tt,exp(-0.2*tt),'--r',tt,exp(-0.4*tt),'--r','Linewidth',2)
xlabel('$t$','Interpreter','latex','Fontsize',24);
ylabel('$E(t)$','Interpreter','latex','Fontsize',24);
hold on 
end

    

