Solve Differential Equations in MATLAB

This tutorial gives step-by-step instructions on how to simulate dynamic systems. Dynamic systems may have differential and algebraic equations (DAEs) or just differential equations (ODEs) that cause a time evolution of the response. The tutorial covers the same problem in both MATLAB and Python.


MATLAB offers several solvers to numerically simulate the solution of sets of differential equations. Below are two examples of solving a first-order decay with different solvers in MATLAB. The objective is to fit the differential equation solution to data by adjusting unknown parameters until the model and measured values match.

The second example demonstrates how this same problem is solved with APM MATLAB.

Large-scale Dynamic Simulation

Additional Material

This same example problem is also demonstrated with Spreadsheet Programming and in the Python programming language. Another example problem demonstrates how to calculate the concentration of CO gas buildup in a room.