Re: solving ode with smaller step




"Akram AlMoussa" <akramalmoussa@xxxxxxxxx> wrote in message
news:fsqio5$a0j$1@xxxxxxxxxxxxxxxxxxxxx
Dear All:
I solved three ODE using ode45 solver, but I need to solve
it with smaller step which means more no. of calculation
points. I would like to solve it with 0.005 . Any body can
help, I am a beginner in Matlab.
Thanks

ODE45 is an adaptive solver, so it chooses what time steps it needs in order
to satisfy the tolerances you specified. There's no way to control the size
of the steps it takes. There are two ways to do what I believe you want:

1) Specify a vector with more than two elements as the TSPAN input to ODE45.
While this won't control the time steps ODE45 uses internally, it will cause
ODE45 to output the function values at those specified time steps. For
instance, if you want to integrate from t = 0 to t = 1 in steps of 0.005,
use a tspan of 0:0.005:1.

2) Solve your ODE as normal, specifying one output argument (so that it's
the struct output argument) and use the DEVAL function to evaluate that
solution at the specified points. I prefer using the first approach, but if
you've already solved your ODE and have the solution structure available,
this will avoid having to solve it again.

--
Steve Lord
slord@xxxxxxxxxxxxx


.



Relevant Pages

  • ode45 + event locator
    ... Is it possible to specify more than one event in the event function for ode45? ... Is it possible to define more than one value so that ode45 terminates whenever ...
    (comp.soft-sys.matlab)
  • Re: ode45
    ... your ODE function should return dF/dt. ... When you call ODE45 with this syntax, first MATLAB calls odefun with 0 input ...
    (comp.soft-sys.matlab)
  • use of anonymous functions in conjunction with ode suite and eval()
    ... consider the ODE function myfunc: ... which is to be solved using ode45. ... By passing the extra parameters after the ode options ... => running myodesolver_script from the command line solves ...
    (comp.soft-sys.matlab)
  • Re: use of anonymous functions in conjunction with ode suite and eval()
    ... consider the ODE function myfunc: ... which is to be solved using ode45. ... With an anonymous function ... I notice that the command line help recommends the first ...
    (comp.soft-sys.matlab)
  • Re: use of anonymous functions in conjunction with ode suite and eval()
    ... consider the ODE function myfunc: ... which is to be solved using ode45. ... By passing the extra parameters after the ode options ... file in the form of a script: ...
    (comp.soft-sys.matlab)