Multi formula ode implementation

1 Ansicht (letzte 30 Tage)
Ajai Singh
Ajai Singh am 5 Okt. 2020
Beantwortet: Ameer Hamza am 5 Okt. 2020
How do i implement an ODE defined by more than one formula.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 5 Okt. 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;
else
dxdt = x.^2;
end
end

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by