Multi formula ode implementation

2 visualizaciones (últimos 30 días)
Ajai Singh
Ajai Singh el 5 de Oct. de 2020
Respondida: Ameer Hamza el 5 de Oct. de 2020
How do i implement an ODE defined by more than one formula.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 5 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by