MAT 275 Lab 4

# MAT 275 Lab 4 - MAT 275 Lab#4 Exercise 1 Part A function...

• Lab Report
• 6
• 100% (22) 22 out of 22 people found this document helpful

This preview shows page 1 - 3 out of 6 pages.

MAT 275 Lab #4 Exercise 1 Part A function LAB04ex1 t0 = 0; tf = 40; y0 = [-1,0]; [t,Y] = ode45(@f,[t0,tf],y0,[]); y = Y(:,1); v = Y(:,2); % y in output has 2 columns corresponding to y and v figure(1); plot(t,y, 'b-' ,t,v, 'r-' ) %Plotting both sides of equation legend( 'y(t)' , 'v(t)=y''t(y)' ) ylim([-1.5,1.5]) grid on figure(2) plot(y,v, 'k' ); axis square ; xlabel( 'y' ); ylabel( 'v' ); %phase plot ylim([-1.5,1.5]) xlim([-1,1]) grid on end function dYdt = f(t,Y) %Define the ODE y = Y(1); v = Y(2); dYdt = [ v; cos(t)-4*v-3*y ]; end Part B At t=38.7814, y is a local max At t=32.4983, y is a local max At t=26.2125, y is a local max At t=19.9324, y is a local max At t=13.6632, y is a local max At t=07.3958, y is a local max Part C The Long term behavior of y oscillates between .25 and -.25 infinitely Part D function LAB04ex1d t0 = 0; tf = 40; y0 = [1.5;5]; a = .8; b = .01; c = .6; d = .1; [t,Y] = ode45(@f,[t0,tf],y0,[]); [t,Y] y = Y(:,1); v = Y(:,2); % y output has 2 columns corresponding to y and v figure(1); plot(t,y, 'r-' ,t,v, 'b-' ) %Plotting both sides of equation legend( 'y(t)' , 'v(t)=y''t(y)' ) ylim([-1.5,1.5]) grid on figure(2)
plot(y,v, 'k' ); axis square ; xlabel( 'y' ); ylabel( 'v' ); %phase plot ylim([-1.5,1.5]) xlim([-1,1]) grid on end function dYdt = fd(t,Y) %Define the ODE y = Y(1); v = Y(2);

Want to read all 6 pages?

Want to read all 6 pages?

#### You've reached the end of your free preview.

Want to read all 6 pages?

### 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