Solve two ODE with IVP euler

2 visualizaciones (últimos 30 días)
shubham kumar gupta
shubham kumar gupta el 17 de En. de 2021
Respondida: Sam Chak el 17 de En. de 2021
I know how to solve a simple ode using euler but confused with putting initial values and solving them
if I have two ODE
dx1/dt=x1*t+x2
and
dx2/dt=2*x1-x2*t
now I have been given initial values/guess
x1,0=1
x2,0=2
delta(t)=0.0001h
and I need to evaluate this ODE using IVP euler from t=0 to t=1h

Respuesta aceptada

Sam Chak
Sam Chak el 17 de En. de 2021
This is one of several ways to simulate the time-varying dynamics.
tspan = 0:0.0001:1; % simulation time and step size
y0 = [1; 2]; % initial condition
[t, y] = ode45(@(t,y) [t*y(1) + y(2); 2*y(1) - t*y(2)], tspan, y0);
plot(t, y)

Más respuestas (0)

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by