I am trying to solve a second order ode using ODE45 but my tspan is not strictly increasing. How can I solve it ?

 Réponse acceptée

Stephan
Stephan le 27 Nov 2019

0 votes

Since ode45 uses an automated stepwide control just define the start and the end of your tspan this way:
tspan = [0 10];
This is all you have to do to solve this problem.

3 commentaires

Asir Tushar
Asir Tushar le 27 Nov 2019
actually I get the tspan from another function. I need that specified values to be tspan.
T0=[0
0
0
0
0
0
0
0
0
0
4.7581
12.1201
8.6331
2.2103
2.2103
2.2103
2.2103
2.2103
2.2103
2.2103
2.2103]
I need to solve this. thare are another 21 of them like these. where the values are not strictly increasing. I am not giving the main code because it is too big with lots of parameters.
tspan = sort(unique(T0));
should solve this.
Asir Tushar
Asir Tushar le 29 Nov 2019
Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by