Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
me5180_numerical/tmp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
25 lines (22 sloc)
1.44 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t=linspace(0,2*pi/50,100); # create time varying from 0-0.126 s (or one period) | |
x=20*sin(50*t);dx=20*50*cos(50*t); # define x and dx/dt in terms of time (note dx=dx/dt) | |
t1=0.2*pi*cos(50*t); dt1=-10*pi*sin(50*t); # define theta1 (t1) and dtheta1/dt | |
t2=0.2*pi*sin(50*t-pi/3); dt2=10*pi*sin(50*t-pi/3); # define theta2 (t2) and dtheta2/dt; | |
L1=1;L2=1.5; # set lengths for L1 and L2 (none were given in problem so 1 and 1.5 mm were | |
# chosen arbitrarily | |
rcc=[x+L1*sin(t1);-L1*cos(t1)]; # position of connection between links | |
rco=[x+L1*sin(t1)+L2*sin(t2);-(L1*cos(t1)+L2*cos(t2))]; # create a row vectors of | |
# x-component and y-component of | |
# pendulum position C (r_C/O) | |
vco=[dx+L1*cos(t1).*dt1+L2*cos(t2).*dt2;(L1*sin(t1).*dt1+L2*sin(t2).*dt2)]; # create row | |
# vectors of | |
# the x- and | |
# y-component | |
# velocity of | |
# point C | |
figure(1) | |
plot(t,vco(1,:),t,vco(2,:)) | |
xlabel('time (s)') | |
ylabel('velocity (mm/s)') | |
legend('x-component','y-component') | |
title('Velocity of end point') |