Advertisement
luizaspan

TAREFA 2 (queda livre)

May 7th, 2015
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #define g 9.8
  5. #define y0 30
  6. #define x0 0
  7. #define v0y 0
  8.  
  9. int main(void)
  10. {
  11.  
  12.   double t,tv,y=y0,x=x0,vy;
  13.   tv=sqrt(2*y0/g);
  14.  
  15.   for (t=0;t<=tv;t+=0.001)
  16.     {
  17.       y=y0-g*t*t/2.;
  18.       vy=v0y-g*t;
  19.       printf("%lf\t %lf\t %lf\n",t,y,vy);
  20.     }
  21.  
  22.  
  23.   return 0;
  24.  
  25. }
  26.  
  27. // plotando no gnuplot:
  28. // plot "t2q1ia.dat" using 1:2 -> plot grafico yxt
  29. // plot "t2q1ia.dat" using 1:3 -> plot grafico vyxt
  30. // plot "t2q1ia.dat" using 2:3 -> plot grafico vyxy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement