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