Pendulum - L=5; theta0=pi/4; thetadot0=0; t=0:.01:25;...

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

View Full Document Right Arrow Icon
%Bryan Choquette % clc clear all data = [0 0; 0 -1]; %line created by pendulum in resting position at theta = 0; data2= [cos(theta) -sin(theta); sin(theta) cos(theta)]; figure(1) axis([-2 2 -2 2]); % set axes range rod = line('xdata',data(1,:),'ydata',data(2,:)); hinge = line(0,0,'marker','o'); bob = line('xdata',data(1,2),'ydata', data(2,2),'marker','o','markersize',15);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: L=5; theta0=pi/4; thetadot0=0; t=0:.01:25; delta_t=1; k=1; while t<25 t=t+delta_t pause(.01) theta_initial(k+1)=(theta_initial(K)+thetadot_initial(k).*delta_t); theta_dot(k+1)=theta(k)-(((g/L).*sin(theta(k)).*delta_t)); set(bob,'xdata',theta_initial(k+1),'ydata',theta_dot(k+1)); drawnow k=k+1 end...
View Full Document

This note was uploaded on 03/22/2012 for the course ENGINEERIM 1000 taught by Professor Ee during the Spring '12 term at Vermont Tech.

Ask a homework question - tutors are online