Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
12 lines (12 sloc) 254 Bytes
dt=[0.5 .1 .001];
figure();
hold on
x=[0:dt(2):3]';
y_n=zeros(size(x));
y_n(1)=1;
for i=2:length(x)
dy=prob2_ode(x,y_n(i-1));
y_n(i)=y_n(i-1)+ dt(2)*dy;
end
plot(x,exp(-x),x,y_n)
legend('Analytical','Euler','Location','Northeast')
You can’t perform that action at this time.