{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info iconThis preview shows pages 1–4. 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 Document Right 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. One would expect the pendulum, when oriented vertically upward, to fall to one side or the other. However, based on the above equations, the pendulum remains in its initial orientation. Theoretically, there is a balance point at this position. e. clear all ; clf tspan = [0 0.5]; v10 = 0; v20 = 0; th10 = 90; th20 = 90; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); p = tip_position(th1, th2); subplot(2,1,1), plot(p(:,1), p(:,2)); xlabel( 'X Position (meters)' ); ylabel( 'Y Position (meters)' ); title( 'Tip Position of a Simple Double Pendulum' ); tspan = [0 2.5]; [t, z] = ode45( 'func1' , tspan, [v10, v20, th10, th20]); th1 = z(:,3); th2 = z(:,4); p = tip_position(th1, th2); subplot(2,1,2), plot(p(:,1), p(:,2)); xlabel( 'X Position (meters)' ); ylabel( 'Y Position (meters)' ); ------------------------------------------- function p = tip_position(th1, th2)
Background image of page 2
a1 = 0.25; a2 = 0.5; x = a1*sin(th1*pi/180) + a2*sin((th1 + th2)*pi/180); y = -a1*cos(th1*pi/180) - a2*cos((th1 + th2)*pi/180); p = [x, y]; ------------------------------------------- For function 'func1' , see part b.
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}