Suppose an object of 20kg is shot upward with an initial velocity of 20m/s. The drag coefficient I've chosen is 0.25, and gravity is 9.8m/s. I'm trying to calculate the terminal velocity using Euler's Method (using a C prog), and then graph the data using openoffice. I know I am converging to the correct terminal velocity, however I'm not confident in my graph of acceleration vs time.(adsbygoogle = window.adsbygoogle || []).push({});

Does this look right?

http://i36.tinypic.com/10p4jmh.png"

Here is my code:

PHP:

#include <stdio.h>

#include <unistd.h>

#include <math.h>

#include <stdlib.h>

double accel(double v);

double velocity(double v, double a, double t);

int main()

{

double a,v,t,time;

v=0.0;

t=0.01;

a=1.0;

time=0.0;

printf("Velocity, Acceleration, Time,\n");

while(fabs(a)>0.00001)

{

a=accel(v);

printf("%f, %f, %f,\n",v,a,time);

v=velocity(v,a,t);

time+=0.01;

}

}

double accel(double v)

{

double a,k,g,m;

k=0.25;

g=9.8;

m=20.0;

if(v!=0.0){

a=(-k*v*v*fabs(v));

a/=m*v;

a-=g;

return a;

}

return -9.8;

}

double velocity(double v, double a, double t)

{

v = v + (a * t);

return v;

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Graphing Terminal Velocity using Euler's Method

**Physics Forums | Science Articles, Homework Help, Discussion**