Comparisons of numerical solution methods
Show older comments
Hello,
I solved the Van Der Pol equation (for m=1) with different numerical methods (ode 45, forward Euler, RK2 and RK4) and I get this graph. However, I can't understand why the curves are getting more and more offset from each other in the course of time. It is noticeable that, taking the ode45 curve as a reference, the forward euler curve shifts positively while the RK2 and RK4 curves shift negatively. Also, when measuring the period of each curve it seems to be constant! I am really confused...
Thank you in advance for your clarifications and have a nice day.

4 Comments
Torsten
on 5 Dec 2022
There are good and bad codes ...
Sam Chak
on 5 Dec 2022
The foundation of the these solvers is based on the Taylor series expansion.
Higher-order terms or derivatives lead to better accuracy in the solution but also become increasingly more complicated at the same time.
The accuracy of the solution in lower-order solvers like Euler's method can be compensated by having smaller step size. However, smaller step size demands large computational effort to obtain acceptable error levels.
Davide Masiello
on 6 Dec 2022
Jiri Hajek
on 6 Dec 2022
...why the curves are getting more and more offset from each other in the course of time...
The short answer is: due to errors accumulating during the solution process in each of the solutions. Each ODE solver does make an error due to approximations used by its numerical method. But each solver makes a different error, that's why the solutions gradually differ from each other. An exception to this would be a process that converges towards a limit value. There, all solvers should converge to the same value, with largers differences somewhere between the initial time and infinity.
Accepted Answer
More Answers (1)
Enrico Incardona
on 8 Dec 2022
0 votes
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!