Initial Step ODE45 not working
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesco Fortunato
el 20 de Oct. de 2018
Comentada: Walter Roberson
el 21 de Oct. de 2018
I am using an ode45 with options but my time vector still doesn't have the 1st step as I defined. I should have t=[0 5 15 25 35...] But I have t=[0 10 20 30...]
tspan=[1 10000]
options = odeset('NormControl','on','RelTol',simul.RelTol,'AbsTol',simul.AbsTol,'InitialStep',5,'Refine',1,'stats','off','MaxStep',MaxStp,'OutputFcn',@IntegrationFcn);
[ t , y ] = ode45( @dy , tspan , y_0 , options );
2 comentarios
madhan ravi
el 21 de Oct. de 2018
Editada: madhan ravi
el 21 de Oct. de 2018
Upload your code for dy
Respuesta aceptada
Walter Roberson
el 21 de Oct. de 2018
When you pass in a tspan that has two elements then ode45 will automatically pick times to evaluate at as needed to maintain accuracy.
You can pass a vector of times instead. ode45 will output for those times. It will continue to evaluate at whichever points it wants to maintain accuracy, but it will calculate for the times given and report only for those.
2 comentarios
Walter Roberson
el 21 de Oct. de 2018
Right. But you would want tspan starting from zero in most conditions, as the first element of tspan tells it the time at which the boundary conditions apply. So for example,
tspan = [0 5 10:10:10000];
Más respuestas (0)
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!