How to check order of accuracy of Euler forward

1 view (last 30 days)
Is there a general code for how to check the accuracy order of Euler forward?
I have the odes:
odes = @(t,y) [0.272 - 0.00136*y(1) - 0.00027*y(1)*y(4);
2.7e-5*y(1)*y(4) - 0.00136*y(2) - 3.6e-2*y(2);
2.43e-4*y(1)*y(4) + 3.6e-2*y(2) - 0.33*y(3);
100*y(3) - 2*y(4)];
for i=1:n
y0(:,i+1)= y0(:,i)+dt*(odes(t(i),y0(:,i)));
i=i+1
end
with
n=200;
dt=120/n;
t=0:dt:120;
y0 = [200; 0; 0; 4e-7];
How can I determine the order of accuracy?

Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!