Advertisement
luizaspan

TAREFA 2 (queda livre II)

May 7th, 2015
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 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 v0x 10
  8. #define v0y 0
  9.  
  10. int main(void)
  11. {
  12.  
  13.   double t,tv,y,x,vy,vx;
  14.   tv=sqrt(2*y0/g);
  15.  
  16.   for (t=0;t<=tv;t+=0.001)
  17.     {
  18.       y=y0+(v0y*t)-((g*t*t)/2);
  19.       x=x0+v0x*t;
  20.       vy=v0y-g*t;
  21.       vx=v0x*t;
  22.  
  23.       printf("%lf\t %lf\t %lf\t %lf\n",t,y,x,vy,vx);
  24.     }
  25.  
  26.   return 0;
  27.  
  28. }
  29.  
  30.  
  31. // plotando no gnuplot:
  32. // p "xxx.dat" u 1:2 -> grafico yxt
  33. // p "xxx.dat" u 1:3 -> grafico xxt
  34. // p "xxx.dat" u 3:2 -> grafico yxx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement