Exam3Answers - Gary Richardson ME 218 18135 Exam 3 Problem...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Gary Richardson ME 218 – 18135 Exam 3 Problem 1: a. - - + - + + + + - - - + - - - - - - + - = 2 1 2 1 2 2 1 2 2 1 2 2 2 2 1 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 2 1 1 2 1 2 2 2 2 2 1 2 1 2 1 2 1 2 1 2 1 ))) ( 2 cos( 2 ( ) cos( cos ) ( ) ( )( sin( 2 ))) ( 2 cos( 2 ( )) cos( ( ) sin( 2 ) 2 sin( sin ) 2 ( V V m m m a m a V m m g m m a V m m m a a V a V m g m m m g V V θ b. clear all ; clf tspan = [0 2]; v10 = 0; v20 = 0; th10 = 5; th20 = 0; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); subplot(2,1,1), plot(t, th1, t, th2); xlabel( 'Time (seconds)' ); ylabel( 'Theta (degrees)' ); title( 'Angles in a Simple Double Pendulum vs. Time' ); legend( 'Theta 1' , 'Theta 2' ); tspan = [0 10]; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); subplot(2,1,2), plot(t, th1, t, th2); xlabel( 'Time (seconds)' ); ylabel( 'Theta (degrees)' ); legend( 'Theta 1' , 'Theta 2' ); ------------------------------------------------------------------ function dv = func1(t, z) a1 = 0.25; a2 = 0.5; m1 = 4.0; m2 = 7.0; g = 9.81; v1 = z(1); v2 = z(2); th1 = z(3)*pi/180; th2 = z(4)*pi/180; v1prime = -g*(2*m1 + m2)*sin(th1) - m2*g*sin(th1 - 2*th2) - 2*sin(th1 - th2)*m2*(v2^2*a2 - v1^2*a1*cos(th1 - th2)); v2prime = 2*sin(th1 - th2)*(v1^2*a1*(m1 + m2) + g*(m1 + m2)*cos(th1) + v2^2*a2*m2*cos(th1 - th2)); th1prime = v1; th2prime = v2; dv = [v1prime; v2prime; th1prime; th2prime]; See Fig. 1.1 for graph. c. clear all ; clf tspan = [0 2]; v10 = 0; v20 = 0; th10 = 45; th20 = 45; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4);
Background image of page 1

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

View Full DocumentRight Arrow Icon
subplot(2,1,1), plot(t, th1, 'b.' , t, th2, 'r.' ); xlabel( 'Time (seconds)' ); ylabel( 'Theta (degrees)' ); title( 'Angles in a Simple Double Pendulum vs. Time' ); legend( 'Theta 1' , 'Theta 2' ); tspan = [0 10]; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); subplot(2,1,2), plot(t, th1, 'b.' , t, th2, 'r.' ); xlabel( 'Time (seconds)' ); ylabel( 'Theta (degrees)' ); legend( 'Theta 1' , 'Theta 2' ); ----------------------------- For function 'func1' , see part b. See Fig. 1.2 for graph. The graph demonstrates that MATLAB uses adaptive step sizes; the time step size varies across the graph. d. clear all ; clf tspan = [0 10]; v10 = 0; v20 = 0; th10 = 180; th20 = 0; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); plot(t, th1, 'b.' , t, th2, 'r.' ); xlabel( 'Time (seconds)' ); ylabel( 'Theta (degrees)' ); title( 'Angles in a Simple Double Pendulum vs. Time' ); legend( 'Theta 1' , 'Theta 2' ); ----------------------------- For function 'func1' , see part b. See Fig. 1.3 for graph.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/07/2008 for the course ME 218 taught by Professor Unknown during the Spring '08 term at University of Texas at Austin.

Page1 / 11

Exam3Answers - Gary Richardson ME 218 18135 Exam 3 Problem...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online