ode45

ODE Solvers

Solve ordinary differential equation using adaptive Runge-Kutta 4/5 (Dormand-Prince). The function f defines dy/dt, tspan is [start, end], and y0 is the initial condition vector. Returns {t, y} arrays.

Syntax

ode45(f, tspan, y0)
ode45(f, [t0, tf], y0)

Examples

ode45('-2*y(1)', [0, 5], [1])
▶ Run
sol = ode45('y(2); -9.81', [0, 2], [0, 10]); plot(sol.t, sol.y)
▶ Run

See Also

Try SimLab — Free MATLAB® Alternative

466 functions. Runs in your browser. No install.

Open SimLab

Stay Updated

Get notified about new simulations and tools. We send 1-2 emails per month.