Multi formula ode implementation

1 visualizzazione (ultimi 30 giorni)
Ajai Singh
Ajai Singh il 5 Ott 2020
Risposto: Ameer Hamza il 5 Ott 2020
How do i implement an ODE defined by more than one formula.

Risposta accettata

Ameer Hamza
Ameer Hamza il 5 Ott 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

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by