How to set Variable-step in ODE15s?
Ältere Kommentare anzeigen
I am trying to solve ODE using ODE15s, but when I change the Variable-step, the result changes. So how to set the step? Thanks.
[t,N]=ode15s(odefun,[0:5:2000],NN0);
The resulet is like the first image. When I changed the step to 10,the result is like the second image.
4 Kommentare
"The resulet is like the first image. When I changed the step to 10,the result is like the second image."
They both look fine to me. When you change the requested t values, of course the outputs will be different. And for a curve with such a sharp peak like that, of course the curves might look slightly different. I don't see what the problem is.
Plot them on the same axes, or set the Y limits to be the same, and you will see that they are the same curve.
ZHUEN RUAN
am 5 Okt. 2018
KSSV
am 5 Okt. 2018
plot both the curves on the same using hold on then you will get know.....use different steps and plot..at one time step..your values get converged..this would be the required time step.
ZHUEN RUAN
am 5 Okt. 2018
Akzeptierte Antwort
Weitere Antworten (1)
Bruno Luong
am 5 Okt. 2018
Bearbeitet: Bruno Luong
am 5 Okt. 2018
[t,N]=ode15s(odefun,[0:5:2000],NN0);
Don't be confuse, the vector in tspan does not specify the solver step, just the solution values to be output at intermediate points you have specified.
1 Kommentar
ZHUEN RUAN
am 5 Okt. 2018
Kategorien
Mehr zu Fit Postprocessing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

