Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( a ) Modify the function ex _ with 2 eqs to solve the IVP ( 4 ) for 0 t 6 0 using the

(a) Modify the function ex_with 2eqs to solve the IVP (4) for 0t60 using the MATLAB
routine ode45. Call the new function LAB04ex1.
Let t,Y(note the upper case Y) be the output of ode 45 and y and v the unknown functions.
Use the following commands to define the ODE:
function dYdt=f(t,Y)
y=Y(1);v=Y(2);
dYdt=[v;-3**sin(t)-3**v-6**y];
Plot y(t) and v(t) in the same window (do not use subplot), and the phase plot showing v vs
y in a separate window.
Add a legend to the first plot. (Note: to display v(t)=y'(t), use 'v(t)=y''(t)').
Add a grid. Use the command ylim ([-2.8,2.8]) to adjust the y-limits for both plots. Adjust
the x-limits in the phase plot so as to reproduce the pictures in Figure 7.
Figure 7: Time series y=y(t) and v=v(t)=y'(t)(left), and phase plot v=y' vs.y for (4).to.=0;tf=20;yo.=[10;60];
a=.8;b=.01;c=.6;d=.1;
[t,y]=ode45(@f,[to.,tf],yo.,[],a,b,c,d);
u1=y(:,1);u2=y(:,2);,% y in output has 2 columns corresponding to u1 and u2
figure(1);
subplot(2,1,1); plot(t,u1,'b-+'); ylabel('u1');
subplot(2,1,2); plot(t,u2,'ro-'); ylabel('u2');
figure(2)
plot(u1,u2); axis square; xlabel('u_1'); ylabel('u_2'); % plot the phase plot
%---------------------------------------------------------
function dydt =f(t,y,a,b,c,d)
u1=y(1);u2=y(2);
dydt =[a**u1-b**u1**u2;-c**u2+d**u1**u2];
end
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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Question in Chemical Engineering Please give Correct Answer 1 4 5 .

Answered: 1 week ago