MATLAB: Solve two ODE with IVP euler

eulerivpMATLABmatlab functionodeplot

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

Best Answer

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)