Skip to content
Permalink
Browse files

added kinematic plotting of Ginsberg p1-10

  • Loading branch information...
rcc02007 committed Jan 17, 2018
0 parents commit f514f06456be97eac0792bb6e462323db1f7d4e0
Showing with 342 additions and 0 deletions.
  1. +11 −0 README.md
  2. +288 −0 double_pendulum.ipynb
  3. +43 −0 double_pendulum.m
  4. BIN figures/p1-10_double_pendulum.png
  5. BIN octave-workspace
  6. BIN pendulum.gif
  7. BIN pendulum_output/00001.png
  8. BIN pendulum_output/00002.png
  9. BIN pendulum_output/00003.png
  10. BIN pendulum_output/00004.png
  11. BIN pendulum_output/00005.png
  12. BIN pendulum_output/00006.png
  13. BIN pendulum_output/00007.png
  14. BIN pendulum_output/00008.png
  15. BIN pendulum_output/00009.png
  16. BIN pendulum_output/00010.png
  17. BIN pendulum_output/00011.png
  18. BIN pendulum_output/00012.png
  19. BIN pendulum_output/00013.png
  20. BIN pendulum_output/00014.png
  21. BIN pendulum_output/00015.png
  22. BIN pendulum_output/00016.png
  23. BIN pendulum_output/00017.png
  24. BIN pendulum_output/00018.png
  25. BIN pendulum_output/00019.png
  26. BIN pendulum_output/00020.png
  27. BIN pendulum_output/00021.png
  28. BIN pendulum_output/00022.png
  29. BIN pendulum_output/00023.png
  30. BIN pendulum_output/00024.png
  31. BIN pendulum_output/00025.png
  32. BIN pendulum_output/00026.png
  33. BIN pendulum_output/00027.png
  34. BIN pendulum_output/00028.png
  35. BIN pendulum_output/00029.png
  36. BIN pendulum_output/00030.png
  37. BIN pendulum_output/00031.png
  38. BIN pendulum_output/00032.png
  39. BIN pendulum_output/00033.png
  40. BIN pendulum_output/00034.png
  41. BIN pendulum_output/00035.png
  42. BIN pendulum_output/00036.png
  43. BIN pendulum_output/00037.png
  44. BIN pendulum_output/00038.png
  45. BIN pendulum_output/00039.png
  46. BIN pendulum_output/00040.png
  47. BIN pendulum_output/00041.png
  48. BIN pendulum_output/00042.png
  49. BIN pendulum_output/00043.png
  50. BIN pendulum_output/00044.png
  51. BIN pendulum_output/00045.png
  52. BIN pendulum_output/00046.png
  53. BIN pendulum_output/00047.png
  54. BIN pendulum_output/00048.png
  55. BIN pendulum_output/00049.png
  56. BIN pendulum_output/00050.png
  57. BIN pendulum_output/00051.png
  58. BIN pendulum_output/00052.png
  59. BIN pendulum_output/00053.png
  60. BIN pendulum_output/00054.png
  61. BIN pendulum_output/00055.png
  62. BIN pendulum_output/00056.png
  63. BIN pendulum_output/00057.png
  64. BIN pendulum_output/00058.png
  65. BIN pendulum_output/00059.png
  66. BIN pendulum_output/00060.png
  67. BIN pendulum_output/00061.png
  68. BIN pendulum_output/00062.png
  69. BIN pendulum_output/00063.png
  70. BIN pendulum_output/00064.png
  71. BIN pendulum_output/00065.png
  72. BIN pendulum_output/00066.png
  73. BIN pendulum_output/00067.png
  74. BIN pendulum_output/00068.png
  75. BIN pendulum_output/00069.png
  76. BIN pendulum_output/00070.png
  77. BIN pendulum_output/00071.png
  78. BIN pendulum_output/00072.png
  79. BIN pendulum_output/00073.png
  80. BIN pendulum_output/00074.png
  81. BIN pendulum_output/00075.png
  82. BIN pendulum_output/00076.png
  83. BIN pendulum_output/00077.png
  84. BIN pendulum_output/00078.png
  85. BIN pendulum_output/00079.png
  86. BIN pendulum_output/00080.png
  87. BIN pendulum_output/00081.png
  88. BIN pendulum_output/00082.png
  89. BIN pendulum_output/00083.png
  90. BIN pendulum_output/00084.png
  91. BIN pendulum_output/00085.png
  92. BIN pendulum_output/00086.png
  93. BIN pendulum_output/00087.png
  94. BIN pendulum_output/00088.png
  95. BIN pendulum_output/00089.png
  96. BIN pendulum_output/00090.png
  97. BIN pendulum_output/00091.png
  98. BIN pendulum_output/00092.png
  99. BIN pendulum_output/00093.png
  100. BIN pendulum_output/00094.png
  101. BIN pendulum_output/00095.png
  102. BIN pendulum_output/00096.png
  103. BIN pendulum_output/00097.png
  104. BIN pendulum_output/00098.png
  105. BIN pendulum_output/00099.png
  106. BIN pendulum_output/00100.png
@@ -0,0 +1,11 @@
# ME5180 - Dynamics

## Examples of Numerical Analysis in Dynamics

### 1- Double Pendulum Kinematics

[double_pendulum.m](./double_pendulum.m) has a script to plot the velocity over time and
create an animation of the link positions. [double_pendulum.ipynb](double_pendulum.ipynb)
shows the output of the code.


Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,43 @@
clear all; close all
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')

% Now plot the position each time step
for i =1:length(t)
hold on
plot([x(i),rcc(1,i),rco(1,i)],[0,rcc(2,i),rco(2,i)]) % plot lines for 2 links
plot(rco(1,:),rco(2,:),'--','LineWidth',2); % this plots all of the positions in the x-y-plane
% over time
plot(rco(1,i),rco(2,i),'o','MarkerSize',10); % this plots the position as a circle at
% timestep i
axis([-30 30 -5 0]) % this sets the axis bounds
filename=sprintf('pendulum_output/%05d.png',i);
print(filename); % another option for saving a plot to a png is the 'print' command
hold off
clf % this clears the figure for the next time step
end
% this is a system command to use ImageMagick's cli 'convert' to create an animated gif
% if you don't have ImageMagick installed, comment this next line
system ("convert -delay 10 -loop 0 pendulum_output/*png pendulum.gif")
Binary file not shown.
BIN +10.6 KB octave-workspace
Binary file not shown.
BIN +1.42 MB pendulum.gif
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.

0 comments on commit f514f06

Please sign in to comment.
You can’t perform that action at this time.