Strange problem with tspan in ode45
Show older comments
Hi all,
I'm currently trying to solve an ODE with ode45. I'm having trouble with the solution I find. It seems that by using as tspan = [0 100] instead than linspace(0,100,100) (for example) in the ode45 inputs, the solution I get changes. I know that these two options are not exactly the same, but I've tried to study the MATLAB documentation related to this issue, and I do not find anything convincent enough. Any clue? Which solution is more accurate?
Below you can find two plots; for different initial conditions. The first column is the solution using tspan = [0 100] and the second column is with the linspace option.
It clearly seems that the option of using tspan = [0 100] is more accurate, but I do not really understand why.



Thanks in advance!!
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary 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!