Argument 'range' for ode45

2 次查看(过去 30 天)
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 ?

采纳的回答

Mischa Kim
Mischa Kim 2014-6-10
编辑:Mischa Kim 2014-6-10
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 个评论
Mischa Kim
Mischa Kim 2014-6-10
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 2014-6-10
Thank you very much Mischa.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by