How do i implement an ODE defined by more than one formula.

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 5 日

0 投票

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2020 年 10 月 5 日

回答済み:

2020 年 10 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by