MAT275_Matlab_lab4

# MAT275_Matlab_lab4 - Alicia Kent – Lab 4 Exercise 1%A...

This preview shows pages 1–4. Sign up to view the full content.

Alicia Kent – Lab 4 Exercise 1 %A LAB04ex1 %B - The blue plotted line, y(t), had local maximums at: % t = .0047, 7.23, 13.66, 19.93, 26.21, 32.49, and 38.78 % The red plotted line, y'(t), had local maximums at: % t = .52, 5.77, 12.09, 18.42, 24.71, 30.99, 37.28 %C % The long term behavior of y oscillates by looking at the graph. %D % The long term behavior of the graph did not change. This is because only % the initial conditions were changed. So only the beginning of the graph % looks different but long term the graph still oscillates. LAB04ex1.m file: function LAB04ex1 t0 = 0; tf = 40; y0 = [1.5,5]; % changed from "[-1,0]" to "[1.5,5]" for Exercise 1 Part C [t,y] = ode45(@f,[t0,tf],y0,[]); [t,y]; %supressed output to see local maximums u1 = y(:,1); u2 = y(:,2); % y in output has 2 columns corresponding to u1 and u2 figure(1); plot(t,u1, 'b-+' ); hold on plot(t,u2, 'ro-' ); legend ( 'v(t)' , 'v(t)=y''(t)' ) ylim([-1.5,1.5]) grid figure(2) plot(u1,u2); axis square ; xlabel( 'y' ); ylabel( 'y=y''' ); % plot the phase plot ylim([-1.5,1.5]) xlim([-1,1]) grid end %---------------------------------------------------------------------- function dYdt= f(t,Y) y=Y(1); v=Y(2); dYdt = [v; cos(t)-4*v-3*y]; end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Alicia Kent Exercise 2 %A LAB04ex2 %B % When the y^2 was added to the IVP, it made the sol. graphs oscillate with % bigger max and min values. The beginning of the graph was

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern