Borrar filtros
Borrar filtros

Argument 'range' for ode45

2 visualizaciones (últimos 30 días)
Douglas Alves
Douglas Alves el 9 de Jun. de 2014
Comentada: Douglas Alves el 10 de Jun. de 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 ?

Respuesta aceptada

Mischa Kim
Mischa Kim el 10 de Jun. de 2014
Editada: Mischa Kim el 10 de Jun. de 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 comentarios
Mischa Kim
Mischa Kim el 10 de Jun. de 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 el 10 de Jun. de 2014
Thank you very much Mischa.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by