Solve two ODE with IVP euler

1 次查看(过去 30 天)
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

采纳的回答

Sam Chak
Sam Chak 2021-1-17
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by