MATLAB Answers

Multi formula ode implementation

1 view (last 30 days)
Ajai Singh
Ajai Singh on 5 Oct 2020
Answered: Ameer Hamza on 5 Oct 2020
How do i implement an ODE defined by more than one formula.

Accepted Answer

Ameer Hamza
Ameer Hamza on 5 Oct 2020
You can define it in the ODE function
IC = 0; % initial conditions
tspan = [0 10]; % initial conditions
ode45(@odefun, tspan, IC)
function dxdt = odefun(t, x)
if x < 0
dxdt = -x;
dxdt = x.^2;

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by