Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define g 9.8
- #define y0 30
- #define x0 0
- #define v0x 10
- #define v0y 0
- int main(void)
- {
- double t,tv,y,x,vy,vx;
- tv=sqrt(2*y0/g);
- for (t=0;t<=tv;t+=0.001)
- {
- y=y0+(v0y*t)-((g*t*t)/2);
- x=x0+v0x*t;
- vy=v0y-g*t;
- vx=v0x*t;
- printf("%lf\t %lf\t %lf\t %lf\n",t,y,x,vy,vx);
- }
- return 0;
- }
- // plotando no gnuplot:
- // p "xxx.dat" u 1:2 -> grafico yxt
- // p "xxx.dat" u 1:3 -> grafico xxt
- // p "xxx.dat" u 3:2 -> grafico yxx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement