What tools and workflows are available for solving differential equations in MATLAB 8.0 (R2012b)?
26 views (last 30 days)
Show older comments
MathWorks Support Team
on 1 Mar 2013
Edited: MathWorks Support Team
on 10 Nov 2022
I would like to solve differential equations using MATLAB 8.0 (R2012b).
Accepted Answer
MathWorks Support Team
on 10 Nov 2022
Edited: MathWorks Support Team
on 10 Nov 2022
The general workflow for solving a differential equation is:
1. Determine the type of differential equation
2. Determine the appropriate MATLAB function
3. Place the equation into the correct form
4. Determine the correct options for the numerical solver
5. Solve
6. Perform post processing if necessary
Please refer below for a more detailed descriptions:
1. Determine the type of differential equation
* Is it an ordinary differential equation. If it is, is the equation known to be stiff?
* Is it a partial differential equation? If it is,
A) How many spatial dimensions are there?
B) What is the domain?
C) What are the boundary conditions?
* Is it a stochastic differential equation?
* Is it a differential algebraic equations?
* In all of the above cases, is the problem well posed? A problem is well posed if a solution exists, is unique, and depends continuously on the input data.
2. Determine the appropriate MATLAB function
For an overview of the differential equation solvers available in MATLAB, please refer to the following link:
https://www.mathworks.com/help/matlab/numerical-integration-and-differential-equations.html
The following are some of the functions used for different types of problems. The list below is incomplete. Please refer to the other functions referenced in the "See Also" section of each function's documentation page. Functions do not require additional toolboxes unless otherwise indicated.
ODE:
Non-stiff: ODE45
Stiff: ODE23s, ODE115
PDE:
Parabolic/Elliptic, 1 spatial dimension: PDEPE
Elliptic, 2 spatial dimension: ASSEMPDE in the Partial Differential Equation Toolbox
Parabolic, 2 spatial dimension: PARABOLIC in the Partial Differential Equation Toolbox
Hyperbolic, 2 spatial dimensions: HYPERBOLIC in the Partial Differential Equation Toolbox.
There is no built-in functionality for three or more spatial dimensions.
Stochastic ODEs:
* SDE in the Econometrics Toolbox.
* SBIOENSEMBLERUN in the SimBiology Toolbox
DAE: ODE15S and ODE23T
3. Place the differential equation into the correct form
This will depend on the function chosen in step 2. For example, you may need to reduce a second order of an ODE to a system of first order ODEs.
4. Determine the correct options for the numerical solver
Each solver uses a different set of options. You will need to refer to the documentation for the function that was chosen in step 2.
5. Solve
6. Perform post processing if necessary.
Generally, post processing falls into one of three categories
* Interpolation the solution returned by the solver
* Plotting the solution
* Error analysis
Useful functions are GRIDDEDINTERPOLANT, PDEVAL, and PDESURF in the Partial Differential Equation Toolbox.
Many problems cannot be directly solved by one of the MathWorks provided numerical solvers in MATLAB. For example, there exists no solver for hyperbolic problems in one spatial dimension. There are several options:
* Write your own solver using other MathWorks functionality.
* Transform the problem into an equivalent problem that can be solved by one of the built in tools.
* Check the File Exchange at MATLAB Central. Please remember that that files posted to this site are not officially supported MathWorks products.
0 Comments
More Answers (1)
Precise Simulation
on 18 Jan 2019
For reference and add an update to the last point, hyperbolic and general PDE type problems can now be solved with the FEATool Multiphysics MATLAB FEM Toolbox avalable directly from the Add-On toolbar or the File Exchange and is fully compatible with MATLAB 2009b and up.
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!