Question: y 1 ' = 6 y 1 + 8 y 2 + 3 e - 2 x y 2 ' = 3 y 1 +

y1'=6y1+8y2+3e-2x
y2'=3y1+y2-5e-2x
In my attempt in using MATLAB to solve for the general solution of ODE as shown and particular solution if y(0)=1 of the question as shown in the picuture. The following are my codings:
% Define the system
function dxdt = system(x, t)
x1= x(1);
x2= x(2);
dxdt =[6*x1+8*x2+3*exp(-2*t); 3*x1+ x2-5*exp(-2*t)];
end
% Define the initial conditions
x0=[1; 0];
% Define the time points
t =0:0.1:10;
% Solve the system
[t, x]= ode45(@system, t, x0);
% Plot the solution
plot(t, x(:,1),'b', t, x(:,2),'r');
xlabel('Time');
ylabel('x1 and x2');
legend('x1','x2');
However, it outputs errors as shown below, i don't know where did i do wrong. Please correct and teach me.
Index exceeds the number of array elements. Index must not exceed 1.
Error in ODE_Q3>system (line 4)
x2= x(2);
Error in odearguments (line 92)
f0= ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45(line 104)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in ODE_Q3(line 15)
[t, x]= ode45(@system, t, x0);
 y1'=6y1+8y2+3e-2x y2'=3y1+y2-5e-2x In my attempt in using MATLAB to solve for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!