HW10_3 - m*g*sin(theta).*(r+L/2); % r = y(:,1); rdot =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%Song, Hwan %HW10,#3 %AAE 340 clc clear all close all; % %Given m=1; L = 30; g = 9.81; t0 = 0; %Initial Time tf = 3; %Final Time tspan = [t0, tf]; u0 = [15 0 -30*pi/180 -.05]; %Initial Conditions options = odeset('RelTol',1e-10,'AbsTol',[1e-12 1e-12 1e-12 1e-12]); % %Numerical Integration [t,y] = ode45('fpen3d', tspan, u0, options); r = y(:,1); rdot = y(:,2); theta = y(:,3); thetadot = y(:,4); % %Energy E = .5*m*(rdot.^2 + r.^2.*thetadot.^2 + L.^2./3.*thetadot.^2) -
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: m*g*sin(theta).*(r+L/2); % r = y(:,1); rdot = y(:,2); theta = y(:,3)*180/pi; thetadot = y(:,4)*180/pi; % %Plots figure(1) plot(t, r) title('r(t) by Song, Hwan') xlabel('Time in sec') ylabel('r in meters') % figure(2) plot(t, theta) title('\theta(t) by Song, Hwan') xlabel('Time in sec') ylabel('\theta in deg') % figure(3) plot(t,E) title('Energy versus Time by Song, Hwan') xlabel('Time in sec') ylabel('Energy in J')...
View Full Document

This document was uploaded on 10/24/2010.

Ask a homework question - tutors are online