Discussion:
Difference in output if I use ode45() or dsolve()
(too old to reply)
Saiprasad Gore
2017-05-01 12:06:03 UTC
Permalink
What will be the difference in output if I use ode45() or dsolve().
On what basis should I choose whether which function should I use to solve a differential equation?
Georgios
2017-05-01 17:54:06 UTC
Permalink
Post by Saiprasad Gore
What will be the difference in output if I use ode45() or dsolve().
On what basis should I choose whether which function should I use to solve a differential equation?
dsolve is part of the Symbolic Math Toolbox, whereas ode45 is built in, so if you do not have access to the Toolbox, you will not be able to use dsolve.

Assuming you do have The Symbolic Math Toolbox, then both dsolve and ode45 should give you the same answer, but it is not that simple.

See link below for a nice discussion on this topic.

http://blogs.mathworks.com/loren/2013/06/10/from-symbolic-differential-equations-to-their-numeric-solution/

Regards,
Georgios
Nasser M. Abbasi
2017-05-01 18:06:43 UTC
Permalink
Post by Saiprasad Gore
What will be the difference in output if I use ode45() or dsolve().
On what basis should I choose whether which function should I use to solve a differential equation?
ode45 is numerical solver. dsolve is symbolic solver. Most ode's
in real life can't be solved analytically so one has to use numerical
solver.

ode45 gives solution as list of numbers (y,t). You can plot.
dsolve gives solution to ode as a formula.

My rule of thumb is: Use dsolve first. If it works great. If not,
use numerical solver such as ode45.

--Nasser

Loading...