Argument 'range' for ode45

4 visualizzazioni (ultimi 30 giorni)
Douglas Alves
Douglas Alves il 9 Giu 2014
Commentato: Douglas Alves il 10 Giu 2014
I have just found out that ode45(@fun,tspin,x) can have instead of tspin = [value1 value2]. tspin could be a linspace(a,b,c) where a,b and c are numbers. What's the difference between these kinds of tspins? I thought it should be only 2 values because integration from value1 to value2. How should I set up tspin in case it's a 3D integration? 6 values should be put in tspin? If so, may this problem have a dimension much bigger than a 3D ?

Risposta accettata

Mischa Kim
Mischa Kim il 10 Giu 2014
Modificato: Mischa Kim il 10 Giu 2014
Douglas, to your first question you would choose linspace if you want the ode solver to return solutions at specific times. If you do not really care about the solution at specific times, simply go with tspin = [value1 value2], where value1 and value2 correspond to a and b.
As far as your second question is concerned I assume you are hinting at partial differential equations, which you would solve with the PDE toolbox.
  3 Commenti
Mischa Kim
Mischa Kim il 10 Giu 2014
Correct. Both approaches give you the same answer, also in terms of accuracy. The only difference is that with the second approach you tell MATLAB at which time points you want an output of the solution. If you do not specify time points MATLAB will do it for you, again, without loss of accuracy.
Accuracy is determined by the solver settings.
Douglas Alves
Douglas Alves il 10 Giu 2014
Thank you very much Mischa.

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by