|
here's the situation:
the motion of a forced spring-mass-damper system, in which the spring constant has linear term 'a' and non-linear term 'b', is governed by the differential equation:
m*f'' + c*f' + a*x + b*x^3 = P cos(wt)
where:
f'' = second order differentiation of t (d^2x/dt^2)
f' = first order differentiation of t (dx/dt)
x = displacement from equilibrium position in metre unit
t = time in seconds unit
m = 1 kg mass
c = 0.4 Ns/m
a = 1 N/m
b = 0.5 N/m^3
P = 0.5 N
angular velocity/omega(written above as 'w') = 0.5 s^-1
initial displacement, x = 0 m
initial velocity, v = dx/dt = 0 m/s
so, the question is:
using at least 2 different numerical methods (euler's, heun's, range-kutta) to solve the above equation for displacement, x and velocity, v as a function of time, t in C coding.
also the additional problems:
1) the effect of time step size on the accuracy of the results for each numerical method. Plot (x and v versus t) obtained using different time steps over the time period 0<<t<<100 on the same figure.
2) the effect of different numerical methods on the accuracy of the results. PLot the results obtained from different method (x and v versus t) over the time period 0<<t<<100 on the same figure with the same time step size for each numerical method.
the main concern is actually the main question which is to solve the equation for displacement, x and velocity, v as a function of time, t by using different numerical method (euler's, heun's, range-kutta) in C coding, meaning each method has to be 1 coding solution.
thanks a million...
|