x'' + 4x' + 2x = sin(2.45 t) with x(0) = 0, x'(0) = 1.11,for t = 0 to 50.

It uses simple Euler integration.

To compile it on a unix machine, type:

gcc sample.c -o sample -lmTo execute it, type:

sample(or

./sample, if necessary).

It should work in Windows as well, but you will have to remove the "system" functions and plot the data some other way.

The plot is stored in a file called "plot.eps". It is overwritten every time the program is executed.

In Mathematica type:

soln = NDSolve[{x''[t] + 4 x'[t] + 2 x[t] == Sin[2.45 t], x[0] == 0, x'[0] == 1.11}, x, {t, 0, 50}];then

Plot[Evaluate[x[t] /. soln], {t, 0, 50}]

y'(1) = -b/m*y(1)+y(2)/m y'(2) = lam*kp*(vd - y(1)) - lam*y(2)Have these two files in your current directory or path. To integrate the system type 'car' (assuming the first file is named car.m). (It's called 'car' since it is a very simple model for a cruise control for a car). First file and second file.

*Last modified: October 20, 2003.
*