Problem Statement
Free Body Diagram and Equation
of Motion
Closed Form Solution
Integrating EOM with Matlab
Plotting Results
The following problem is for the system consists of mass, spring
and damper.
This is exactly same as a previous example, Damped Free
Vibration except we now have an external force.
The procedure will be same as before: FBD first, then the equation of
motion using FBD and force balance, Matlab coding and finally some
results.
The below is the drawing of the mass-spring-damper system.
We can write down the equation of motion for this 1 degree of freedom
system with FBD above using force balance.
From the free body digram we can write the force balance equations as follow. Consider the right-going direction as the positive x-direction to get
| (1) |
where m is the mass of the system, k is the stiffness of the spring, and
c is the viscous damping coefficient
F(t) is the excitation force acting on the mass. In the current problem,
the external force is a harmonic function
.Thus the above equation becomes
| (2) |
We will solve for the homogeneous solution and the particular solution
of the system. The particular solution is necessary here since the external
force is not zero as in the free vibrations examples. Both the homogeneous and
particular solutions together will be the closed form solution.
The total response of the system with the external force is the sum of the homogeneous and particular solutions.
| x(t)=xh(t)+xp(t) | (1) |
We already have the closed form solution to the homogeneuos problem from the previous MATLAB tutorial, therefore we will focus on the particular solution here.
Any function that satisfies the equation of motion is the particular soluton. Since the external force is harmonic, it is reasonable to guess that the particular solution is also harmonic.
| (2) |
Here D and
will be determined to satisfy the equation of motion.
substituting the assumed solution form into the governing equation yields
| (3) |
![]() |
(4) |
Since the amplitude of the particular solution is constant, the particular
solution is also called the steady-state solution. After the transient part of
the solution (homogeneous) is damped out, the system will oscillate according to
xp(t) so long as the driving force
is applied.
Thus the steady state solution can be written as
![]() |
(5) |
The closed form solution can be coded into Matlab. The first solution consists of both the homogeneous (transient) solution plus the particular (steady-state) solution. The second is just the steady-state solution
Once again we will also use Matlab to intgrate the equation of motion. The only
difference from the free vibration problems is that the state space equation for
position also contains the force term on the right hand side.
The following is the MATLAB code for ODE45 solver solution
of mass-spring system.
If you need to see the basic operation of ODE45 solver,
see Matlab Assistance.
m = 1; % mass of the system in meter k = 50; % stiffness of the spring (N/m) c = 20; % damping coefficient wn = sqrt(k/m); % natural frequency (rad/sec) zeta = c/(2*wn*m) % viscous damping factor t_final = 2; % calculation timeThe initial conditions are shown. tol is the tolerance for ODE45 solver. The higher it is, the more accurate the answer will be, but the calculation takes more time.
x_0 = 1; % initial displacement xdot_0 = 0; % initial velocity X_0 = [x_0,xdot_0]; % form a vector(array) of initial conditions tol = 1e-6; % tolerance of error for ODE45 solverUsing ODE45 solver, we can solve for the displacement x(t) and velocity xdot(t).
t_final = 3; % calculation time
[t,y] = ode45('forcedsub',0,t_final,X_0,tol);
x = y(:,1); % displacement x(t)
x_dot = y(:,2); % velocity x_dot(t)
Here's the subprogram forcedsub.m.
function ydot = forcedsub(t,y) m = 2; % mass of the system in meter k = 5000; % stiffness of the spring (N/m) c = 30; % damping coefficient P = 100; % magnitude of force Omega = 20; % frequency of force yd1 = y(2); yd2 = (-k*y(1)-c*y(2)+P*sin(Omega*t))/m; ydot = [yd1;yd2];
NOTE that we did not discretize the critically
damped case from
underdamped case and overdamped case since this ODE45 solver
takes care of that automatically, i.e. we did not have singular
matrix as we had with closed form solution.
Here are the complete list of the main program and subprogram.
Results shows the homogeneous response (transient response), the
particular response (steady-state response) and the sum of those two (
total response).
Also, the results for the frequency-amplitude and frequency-phase angle
solution.