Argument 'range' for ode45

3 vues (au cours des 30 derniers jours)
Douglas Alves
Douglas Alves le 9 Juin 2014
Commenté : Douglas Alves le 10 Juin 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 ?

Réponse acceptée

Mischa Kim
Mischa Kim le 10 Juin 2014
Modifié(e) : Mischa Kim le 10 Juin 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 commentaires
Mischa Kim
Mischa Kim le 10 Juin 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 le 10 Juin 2014
Thank you very much Mischa.

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