Untitled3

# Untitled3 - 2 Plots subplot(321 plot(t,theta*180/pi...

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

f % Homework % Problem #3 %Problem Set 7 Problem 3 % clear all close all clc c % Time Set up to = 0.; tf = 10000; tspan = [to,tf]; tt = [to:0.001:tf]; t % Given theta0 = 0; % in m thetadot0 = 0; % in m/s gamma0 = 30 *pi()/180; % in rad gammadot0 = -.1 *pi()/180; % in rad/s L = 5; % in m R = 3; % in m R % ODE45 u0 = [ theta0 thetadot0 gamma0 gammadot0 ]; dt = [to,tf]; options = odeset('RelTol',1e-10,'AbsTol',[1e-12 1e-12 1e-12 1e-12]); [t,u] = ode45('fpen3d',tspan,u0,options); [ theta = u(:,1); theta_dot = u(:,2); gamma = u(:,3); gamma_dot = u(:,4); g % Energy Equation E = L^2.*(theta_dot + gamma_dot).^2 + 3/2*R^2.*theta_dot.^2 +2*R.*theta_dot.*L.*cos(gamma).*(gamma_dot+theta_dot); + % Angular Momentum Equation H = abs(3*R^2.*theta_dot + 2*L^2.*(theta_dot+gamma_dot) + 2*R*L.*(2.*theta_dot+gamma_dot).*cos(gamma));

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: 2 % Plots subplot(321) plot(t,theta*180/pi()) title({'\theta History by Song, HWan'}) xlabel('Time in sec') ylabel('theta in deg') grid on; g subplot(322) plot(t,gamma*180/pi()) title({'\gamma History in Song, Hwan'}) xlabel('Time in sec') ylabel('gamma in deg') grid on; g subplot(323) plot(theta*180/pi(),gamma*180/pi()) title({'\gamma vs. \theta by Song, Hwan'}) xlabel('\theta in deg') ylabel('\gamma in deg') grid on; g subplot(324) plot(t,E) title({'Energy History by Song, Hwan'}) xlabel('Time in sec') ylabel('Energy in Joule') grid on; g subplot(325) plot(t,H) title({'Angular Momentum History by Song, Hwan'}) xlabel('Time in sec') ylabel({'Angular Momentum (Nms)'}) grid on;...
View Full Document

### Page1 / 2

Untitled3 - 2 Plots subplot(321 plot(t,theta*180/pi...

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

View Full Document
Ask a homework question - tutors are online