
286 Introduction to Computational Modeling
FIGURE 19.8: Vertical velocity of free-falling object.
double
*
lparams = (double
*
) params_ptr;
double m = lparams[0]; /
*
mass of object
*
/
double c = lparams[1]; /
*
drag constant
*
/
/
*
evaluate the right-hand-side functions at t
*
/
f[0] = y[1];
f[1] = (c/m)
*
y[1]
*
y[1] - G;
return GSL_SUCCESS; /
*
GSL_SUCCESS defined in gsl/errno.h as 0
*
/
}
Figure 19.7 shows the graph of the vertical displacement with time generated
by Gnuplot. Observe that after about 10 seconds, the displacement changes linearly.
Figure 19.8 shows the graph of vertical velocity of the object with time. Observe that
the velocity of the object increases