clf;clear;clc
h=0.1
t0=0
tn=10
t=0:h:tn;
y0=[0;0];
A=[-5,0;5,0];
%si quisiera el numero de subintervalos
N=round((tn-t0)/h);
y=zeros(2,N+1);
y(:,1)=y0;
%con linespace(t0,tn,n+1)
for i=1:N;
y(:,i+1)=(eye(2)-h/2*A)\(y(:,i)+h/2*(A*y(:,i)+[1*exp(-1*t(i));0]+[1*exp(-1*t(i+1));0]));
end
hold on
plot(t,y(1,:))
plot(t,y(2,:),'r')
z=exp((-5)*t);
plot(t,z,'g')


