# hw3 - figure(2 subplot(3,2,1 plot(t,r xlabel(’time[s]’...

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

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

View Full Document

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

View Full Document
function p12c7(ti,tf,npts) % function m-file to solve problem 12.C7 in Beer, Johnston, 7th Edition % solution: % Fr = m*ar % Ftheta = m*atheta % where % ar = d2r/dt2 - dr/dt*dtheta/dt % atheta = r*d2theta/dt + 2*dr/dt*dtheta/dt % % input variables % ti - initial time, given as 0s % tf - final time, given as 1.5s % npts - number of (time) points where we want to evaluate the forces % % to see plots for , at the matlab prompt type p12c7(0,1.5,25) % local variables m = 0.25; % mass of particle B t = linspace(ti,tf,npts); % create vector containing all the time % values where we want to evaluate the forces r = t.^3 - 2*t.^2; % vector of the r(i) values corresponding to % each t(i) rdot = 3*t.^2 - 4*t; r2dot = 6*t-4; theta = t.^3 - 4*t; thetadot = 3*t.^2 - 4*ones(size(t)); theta2dot = 6*t; ar = r2dot - r.*(thetadot.^2); atheta = r.*theta2dot + 2*rdot.*thetadot; Fr = m*ar; Ftheta = m*atheta; subplot(2,1,1), plot(t,Fr) xlabel(’time [s]’) ylabel(’F_r [N]’) grid subplot(2,1,2), plot(t,Ftheta) xlabel(’time [s]’) ylabel(’F_{\theta} [N]’) grid

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.

Unformatted text preview: figure(2) subplot(3,2,1), plot(t,r) xlabel(’time [s]’) ylabel(’r [m]’) grid subplot(3,2,3), plot(t,rdot) xlabel(’time [s]’) ylabel(’dr/dt [m/s]’) grid subplot(3,2,5), plot(t,r2dot) xlabel(’time [s]’) ylabel(’d^2r/dt^2 [m/s^2]’) grid subplot(3,2,2), plot(t,theta) xlabel(’time [s]’) ylabel(’\theta [rad]’) grid subplot(3,2,4), plot(t,thetadot) xlabel(’time [s]’) ylabel(’d\theta/dt [rad/s]’) grid subplot(3,2,6), plot(t,theta2dot) xlabel(’time [s]’) ylabel(’d^2\theta/dt^2 [rad/s^2]’) grid Feb 20, 05 21:37 Page 1/1 p12c7.m Printed by Monday February 21, 2005 1/1 0.5 1 1.5-1 1 2 3 4 time [s] F r [N] 0.5 1 1.5-3-2-1 1 2 time [s] θ 0.5 1 1.5-1.5-1-0.5 time [s] r [m] 0.5 1 1.5-2-1 1 time [s] dr/dt [m/s] 0.5 1 1.5-5 5 time [s] d 2 r/dt [m/s ] 0.5 1 1.5-4-3-2-1 time [s] θ [rad] 0.5 1 1.5-4-2 2 4 time [s] /dt [rad/s] 0.5 1 1.5 5 10 time [s] /dt [rad/s...
View Full Document

{[ snackBarMessage ]}

### Page1 / 6

hw3 - figure(2 subplot(3,2,1 plot(t,r xlabel(’time[s]’...

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

View Full Document
Ask a homework question - tutors are online