Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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);
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

LO2 Describe the human resource planning process.

Answered: 1 week ago