New ODE and DAE Solver
This example demonstrates the numerical integration of simple Differtial Algebraic Equations (DAEs). Similar to ODE integrators in MATLAB, it can handle ODE stiff systems as well as high index (Index 2+) DAE systems. See the following YouTube video for a step-by-step tutorial.
The directory contains a folder (apm) that contains the library of functions for working with APM. The model file (demo.apm) contains the following text:
Model
Parameters
tau = 5
K = 3
u
End Parameters
Variables
x = 0
y = 0
End Variables
Equations
tau * $x + x = K * u
y = 2 * x
End Equations
End Model
The data file (demo.csv) specifies the time points and any inputs to the model. In this case, the input 'u' is specified at the following time intervals:
time, u
0, 0
0.5, 0
1, 1
2, 1
3, 1
5, 1
8, 1
12, 1
15, 1
18, 1
21, 1
22, 1
25, 1
28, 1
30, 1
The function 'apm_solve' receives an input of the application name (in this case 'demo') and returns a structure with the results of the simulation. In this case, the solution is returned into a structure named 'z'.
z = apm_solve('demo');
The structure contains all of the parameters and variables defined in the model file as well as the time points. A plot of 'time' and 'x' is provided with the demo and these are referenced as 'z.time' and 'z.x'.
The APMonitor Modeling Language (http://apmonitor.com) is optimization software for ODEs and DAEs. It is a full-featured modeling language with interfaces to MATLAB and Python. It is coupled with large-scale nonlinear programming solvers (including APOPT and IPOPT) for parameter estimation, nonlinear optimization, simulation, and model predictive control. There is a discussion group as well as regular webinars for those interested in dynamic modeling and simulation.
Citar como
John Hedengren (2024). New ODE and DAE Solver (https://www.mathworks.com/matlabcentral/fileexchange/39030-new-ode-and-dae-solver), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- Mathematics and Optimization > Optimization Toolbox > Linear Programming and Mixed-Integer Linear Programming >
- MATLAB > Mathematics > Numerical Integration and Differential Equations > Ordinary Differential Equations >
Etiquetas
Agradecimientos
Inspirado por: Optimization, Nonlinear Control, and Estimation Toolbox, MINLP: Mixed Integer Nonlinear Programming, Model Predictive Control
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
apm/
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 |