Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 0.42 KB | None | 0 0
  1. clc;
  2. clear all;
  3.  
  4. tau = 0.0001;
  5. L = 9.8;
  6. g = 9.8;
  7. alpha(1) = 1.4;
  8. omega(1) = 0.0;
  9. x(1) = L * cos(alpha(1)) / 2;
  10. y(1) = L * sin(alpha(1)) / 2;
  11. i = 1;
  12. while (alpha(i) > 0.0)
  13.     alpha(i + 1) = alpha(i) + omega(i) * tau;
  14.     omega(i + 1) = omega(i) - g / L * tau * cos(alpha(i + 1));
  15.     x(i + 1) = L * cos(alpha(i + 1)) / 2;
  16.     y(i + 1) = L * sin(alpha(i + 1)) / 2;
  17.     i = i + 1;
  18. end
  19.  
  20. plot(x,y);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement