Vibration Lecture 3
Vibration Lecture 3
Lecture 3
Solution of the Vibration Equation
1. Introduction
The differential equations that govern the vibration system is given by:
where
𝑚: Inertia coefficient
𝑐: Damping coefficient
𝑘 Stiffness coefficient
𝑥 : Displacement
𝑑𝑥
𝑥̇ : Velocity = 𝑑𝑡
𝑑2 𝑥 𝑑𝑥̇
𝑥̈ : Acceleration = 𝑑𝑡 2 = 𝑑𝑡
𝑓(𝑡): Forcing function that might depend on time.
In the linear theory of vibration, 𝑚, 𝑐 and 𝑘 are constant coefficients. If the forcing
function 𝑓(𝑡) is equal to zero, Eq. 1 is described as homogeneous, second order
differential equation. If the forcing function 𝑓(𝑡) is not equals to zero, Eq. 1 is
described as nonhomogeneous, second order differential equation. The
nonhomogeneous differential equation corresponds to the case of forced vibration
and the homogeneous differential equation corresponds to the case of free vibration.
In the following sections we present methods for obtaining solutions for both
homogeneous and nonhomogeneous differential equations.
In this section, techniques for solving linear, homogeneous, second order differential
equations with constant coefficients are discussed. Whenever the right-hand side of
Eq. 1 is identically zero, that is
𝑓(𝑡) = 0 (2)
1
By a solution of Eq. 3 we mean a function x(t) which, with its derivatives, satisfies the
differential equation. A solution to Eq. 3 can be obtained by trial and error. A trial
solution is to assume the function 𝑥(𝑡) in the following form
𝑥(𝑡) = 𝐴𝑒 𝑝𝑡 (4)
The general solution of the differential equation, provided that the roots of the
differential equation are not equal, can be written as
Clearly the solution of the differential equation depends on the roots 𝑝1 and 𝑝2 .
There are three different cases for the roots 𝑝1 and 𝑝2 as shown in Table 1.
2
Table 1.1. Different Cases of the solution of the second order homogeneous
differential equation with constant coefficients.
3
Example 1.1
𝑥̈ − 4𝑥̇ + 3𝑥 = 0
b. If the initial conditions are 𝑥𝑜 = 2 and 𝑣𝑜 = 0, plot the response.
Solution.
𝑐2 ? 4𝑚𝑘
16 > 4 × 1 × 3
−𝑐 + √𝑐2 − 4𝑚𝑘
𝑝1 =
2𝑚
−(−4) + √42 − 4 × 1 × 3
𝑝1 =
2×1
𝑝1 = 3
−𝑐 − √𝑐2 − 4𝑚𝑘
𝑝2 =
2𝑚
2
−(−4) − √4 − 4 × 1 × 3
𝑝2 =
2×1
𝑝2 = 1
The solution is
𝑥(𝑡) = 𝐴1 𝑒 3𝑡 + 𝐴2 𝑒 𝑡
𝑥𝑜 𝑝2 − 𝑣𝑜
𝐴1 =
𝑝2 − 𝑝1
4
2×1−0
𝐴1 =
1−3
𝐴1 = −1
𝑣𝑜 − 𝑝1 𝑥𝑜
𝐴2 =
𝑝2 − 𝑝1
0−3×2
𝐴2 =
1−3
𝐴2 = 3
The solution is
𝑥(𝑡) = 𝐴1 𝑒 3𝑡 + 𝐴2 𝑒 𝑡
𝑥(𝑡) = −𝑒 3𝑡 + 3𝑒 𝑡
5
Matlab Code of Example 1.1:
Example 1.2
𝑥̈ + 6𝑥̇ + 9𝑥 = 0
Solution.
𝑐2 ? 4𝑚𝑘
36 = 4 × 1 × 9
−𝑐 −6
𝑝1 = = = −3
2𝑚 2 × 1
6
The solution is
𝑐1 = 𝑥𝑜 = 0
𝑐2 = 𝑣𝑜 − 𝑝1 𝑥𝑜 = 1 − (−3) × 0 = 1
The solution is
𝑥(𝑡) = 𝑡𝑒 −3𝑡
7
Matlab Code of Example 1.2:
% Example 1.2
clear all; clf; clc
Tf=4; %Final time, sec
%time Step
dt=1e-3;
no_data_points=Tf/dt; %number of data points to plot
for i=1:no_data_points+1
t(i)=(i-1)*dt;
x(i)=t(i).*exp(-3*t(i));
end
%plotting
figure(1);plot(t,x,'linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
axis([0 Tf+1 .8*min(x) 1.2*max(x)])
grid on
title('Example 1.2 ','FontSize',16);
saveas(gcf, 'Example 1_2.tiff');
Example 1.3
Solution.
𝑐2 ? 4𝑚𝑘
4 < 4 × 5 × 50
𝑐 2
𝛼=− =− = −0.2
2𝑚 2×5
1 1
𝛽= √4𝑚𝑘 − 𝑐2 = √4 × 5 × 50 − 22 = 3.156
2𝑚 2×5
8
The solution is
𝑣𝑜 − 𝛼𝑥𝑜 2
𝑋 = √𝑥02 + ( )
𝛽
2
3 − (−0.2) × 0.01
𝑋 = √0.012 + ( ) = 0.9512
3.156
𝛽𝑥𝑜
𝜙 = tan−1
𝑣𝑜 − 𝛼𝑥𝑜
3.156 × 0.01
𝜙 = tan−1 = 0.6023°
3 − (−0.2) × 0.01
9
Matlab Code of Example 1.3:
% Example 1.3
clear all; clf; clc
Tf=10; %Final time, sec
%time Step
dt=1e-3;
no_data_points=Tf/dt; %number of data points to plot
for i=1:no_data_points+1
t(i)=(i-1)*dt;
x(i)=0.9512*exp(-0.2*t(i))*sin(3.156*t(i)+.6023*pi/180);
end
%plotting
figure(1);plot(t,x,'linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
axis([0 Tf+1 1.2*min(x) 1.2*max(x)])
grid on
title('Example 1.3 ','FontSize',16);
saveas(gcf, 'Example 1_3.tiff');
General Matlab code for solving solve homogeneous second order differential
equation of single degree of freedom vibratory system
10
A2=(vo-xo*p1)/(p2-p1);
for i=1:no_data_points+1
t(i)=(i-1)*dt;
x(i)=A1*exp(p1*t(i))+A2*exp(p2*t(i));
end
end
% Critically damped System C^2=4mk
if C==0
p1_1= (-c/(2*m));
c1=xo;
c2=vo-xo*p1_1;
for i=1:no_data_points+1
t(i)=(i-1)*dt;
x(i)=(c1+c2*t(i))*exp(p1_1*t(i));
end
end
% Undrdamped System C^2<4mk
if C<0
alpha= (-c)/(2*m);
beta= (sqrt(4*m*k-c^2))/(2*m);
X=sqrt(xo^2+((vo-alpha*xo)/beta)^2);
phi=atand((beta*xo)/(vo-alpha*xo));
for i=1:no_data_points+1
t(i)=(i-1)*dt;
x(i)=X*exp(alpha*t(i))*sin(beta*t(i)+phi*pi/180);
end
end
%plotting
figure(1);plot(t,x,'linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
axis([0 Tf+0.2 1.2*min(x) 1.2*max(x)])
grid on
Dsolve command in Matlab can be used to find the analytical solution of first and
second order ODE as shown in the following two examples.
Example 1.4
𝑥̇ (𝑡) = 2𝑡 − 𝑥, 𝑥(0) = 1
11
Matlab Program 1.5
% Example 1-4
X=dsolve('Dx-2*t+x=0','x(0)=1','t')
X=simple(X);
pretty(X)
ezplot(X,(0:0.05:0.3))
Matlab Output
X =
2*t + 3*exp(-t) - 2
2 t + 3 exp(-t) - 2
𝑥(𝑡) = 3𝑒 −𝑡 + 2𝑡 − 2
Example 1.5
% Example 1-5
clc; clear all; clf;
tf=20;
12
X=dsolve('3*D2x+1*Dx+2*x=0','Dx(0)=0.25','x(0)=0','t');
X=simple(X)
pretty(X)
ezplot(X,(0:0.01:20))
grid on
saveas(gcf, 'Example 1_5.tiff');
Matlab Output
X =
(3*23^(1/2)*exp(-t/6)*sin((23^(1/2)*t)/6))/46
/ 1/2 \
1/2 / t \ | 23 t |
3 23 exp| - - | sin| ------- |
\ 6 / \ 6 /
---------------------------------
46
The exact solution is
𝑡
𝑥(𝑡) = 0.31𝑒 −6 sin (0.79𝑡)
13
3. Solution of nonhomogeneous differential Equation with constant
coefficients
where 𝑓(𝑡) is the forcing function. The solution of the equation consists of two parts.
First the complementary solution 𝑥𝑐 of Eq.8 where the right hand side is equal to zero,
that is, 𝑓(𝑡) = 0. Methods for obtaining the complementary solutions were discussed
in the proceeding sections. The second part of the solution is the particular solution,
𝑥𝑝 . The complete solution of Eq.8 can be written as
𝑥 = 𝑥𝑐 + 𝑥𝑝 (9)
𝑥𝑝 =
𝐹0
(13)
𝑘
𝐹0 𝑐𝜔
𝑥𝑝 = sin (𝑤𝑡 − (𝑡𝑎𝑛−1 ( ))) (15)
√(𝑘 − 𝑚𝜔 2 )2 + (𝑐𝜔)2 𝑘 − 𝑚𝜔 2
14
4. Numerical Simulation of the time response
The solution of the vibration problems is often plotted versus time in order to
visualize the physical vibration and to obtain an idea of the nature of the response.
For simple vibration problems, there is analytical (closed form solution for the
displacement as a function of time) solution. However for real life problems, the
equations are more complex and sometimes nonlinear that is difficult or impossible
to solve analytically. The use of numerical solution (integration) greatly enhances the
understanding of vibration. Just as a picture is worth a thousand words, a numerical
simulation or plot can enable a completely dynamic understanding of vibration
phenomena. Computer calculations and simulations are presented at the end of each
chapter.
The free response of any system is usually computed by simple numerical means such
as Euler’s method, Heun’s or Runge-Kutta methods. The basis of the numerical
solutions of ordinary differential equations is to essentially undo calculus by
representing each derivative by a small but finite difference. A numerical solution of
an ordinary differential equation is a procedure for constructing approximate values:
x1, x2, …, xn, of the solution x(t) at the discrete values of time: to < t1 … <tn. Effectively,
a numerical procedure produces a list of discrete values xi = x(ti) that approximates
the solution, as shown in Fig.1, rather than a continuous function x(t), which is the
exact solution.
15
For a single degree of freedom system of the form
the initial values xo (initial displacement) and vo (initial velocity) form the first two
points of the numerical solution. The equation will be solved for values of time 𝑡
between 𝑡 = 0 and 𝑡 = 𝑇𝑓 , where 𝑇𝑓 is the total length of time over which the solution
is of interest. The time interval 𝑇𝑓 − 0 is then divided into 𝑛 intervals (so that ∆𝑡 =
𝑇𝑓 ⁄𝑛 ). Then Eq.16 is calculated at the values of 𝑡𝑜 = 0, 𝑡1 = ∆𝑡, 𝑡2 = 2∆𝑡, … , 𝑡𝑛 =
𝑛∆𝑡 = 𝑇𝑓 to produce an approximate representation, or simulation, of the solution.
The concept of a numerical solution is easiest to grasp by first examining the
numerical solution of a first order scalar differential equation. To this end consider
the first order differential equation
𝑓(𝑡𝑖 , 𝑥𝑖 ) = 𝐴𝑖
𝑥𝑖+1 − 𝑥𝑖
= 𝐴𝑖
∆𝑡
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
Euler’s Equations
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝐴𝑖 = 𝑓(𝑡𝑖 , 𝑥𝑖 )
(18)
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
Example 2.1
16
Solution
𝑥𝑜 = 1 , 𝑡𝑜 = 0
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡 = 𝑡𝑖 + 0.1
𝐴𝑖 = 𝑓(𝑡𝑖 , 𝑥𝑖 ) = 5𝑥𝑖
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
For i=0:
𝑡1 = 𝑡0 + ∆𝑡 = 0 + 0.1 = 0.1
𝐴0 = 𝑓(𝑡0 , 𝑥0 ) = 5𝑥0 = 5 × 1 = 5
For i=1:
Iteration, 𝑖 𝑡𝑖 𝑥𝑖 𝐴𝑖 ∆𝑡𝐴𝑖
0 0 1 5×1=5 0.1 × 5 = 0.5
1 0.1 1 + 0.5 = 1.5 5 × 1.5 0.1 × 7.5
2 0.2 1.5 + 0.75 = 2.25
= 7.5 = 0.75
X=dsolve('Dx-5*x=0','x(0)=1','t')
X=simple(X);
pretty(X)
𝑥(𝑡) = 𝑒 5𝑡
17
A comparison between Euler method numerical solution and the exact solution is
shown in Fig. 1.7.
18
x_exact(i+1)=1*exp(a*(t(i)+dt));
end
t(i+1)=(i)*dt;
%plotting
figure(1);plot(t,x,'linewidth', 2);
hold on
plot(t,x_exact,'r:','linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
% axis([0 Tf+0.2 1.2*min(x) 1.2*max(x)])
grid on
legend('Euler', 'Exact','location', 'best')
title('Example 2.1 ','FontSize',16);
saveas(gcf, 'Example 2_1.tiff');
Example 2.2
Solution
𝑥𝑜 = 1 , 𝑡𝑜 = 0
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡 = 𝑡𝑖 + 0.1
𝐴𝑖 = 𝑓(𝑡𝑖 , 𝑥𝑖 ) = 2𝑡𝑖 − 𝑥𝑖
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
For i=0:
𝑡1 = 𝑡0 + ∆𝑡 = 0 + 0.1 = 0.1
𝐴0 = 𝑓(𝑡0 , 𝑥0 ) = 2𝑡0 − 𝑥0 = 2 × 0 − 1 = −1
For i=1
19
𝑡𝑖 𝑥𝑖 𝐴𝑖 ∆𝑡𝐴𝑖
0 0 1 −1 −0.1
1 0.1 0.9 −0.7 −0.07
2 0.2 0.83
It was shown in example 1.4 that the exact solution of this differential equation is
𝑥(𝑡) = 3𝑒 −𝑡 + 2𝑡 − 2
Iteration, 𝑖
A comparison between Heun method numerical solution and the exact solution is
shown in Fig. 1.8.
20
clear all; clf; clc
% xdot=ax+bt+c
%Inputs
a=-1;
b=2;
c=0;
Tf=0.5; %Final time, sec
dt=1e-1; %time step
%initial conditions
x(1)=1; % initial displacement
x_exact(1)=x(1);
error(1)=abs(x(1)-x_exact(1))/(x_exact(1))*100;
no_data_points=Tf/dt; %number of data points to plot
for i=1:no_data_points
t(i)=(i-1)*dt;
A(i)= a*x(i)+b*t(i)+c;
x(i+1)=x(i)+A(i)*dt;
x_exact(i+1)=3*exp(-(t(i)+dt))+2*(t(i)+dt)-2;
error(i+1)=abs(x_exact(i+1)-x(i+1))/(x_exact(i+1))*100;
end
t(i+1)=(i)*dt;
%plotting
figure(1);plot(t,x,'linewidth', 2);
hold on
figure(1);plot(t,x_exact,'r:','linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
grid on
legend('Euler', 'Exact','location', 'best')
title('Example 2.2 ','FontSize',16);
saveas(gcf, 'Example 2_2.tiff');
Euler is a first order method that assumes that the slope is constant in the time step
and uses the slope at the beginning. The error in Euler method is first order error and
is related of the time step. That means if you halve the time step the error will halve.
So by decreasing the time step, the error will decrease, but there are better methods
of numerical integration with a higher order error. The better method will find a
better slope.
21
6. Heun’s (Modified Euler’s) Method for first order ODE
This method calculates two slopes, the slope at the beginning and end of the time step.
Then by averaging the two slopes we will get a better slope than Euler method.
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝐵𝑖 = 𝑓(𝑡𝑖 , 𝑥𝑖 )
𝑥̃𝑖+1 = 𝑥𝑖 + ∆𝑡𝐵𝑖
𝐵𝑖 + 𝐶𝑖
𝐴𝑖 =
2
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝑥̃𝑖+1 = 𝑥𝑖 + ∆𝑡𝑓(𝑡𝑖 , 𝑥𝑖 )
Example 2.3
22
Solution
𝑥𝑜 = 1 , 𝑡𝑜 = 0
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡 = 𝑡𝑖 + 0.1
𝐵𝑖 = 𝑓(𝑡𝑖 , 𝑥𝑖 ) = 2𝑡𝑖 − 𝑥𝑖
𝑥̃𝑖+1 = 𝑥𝑖 + ∆𝑡𝐵𝑖
𝐵𝑖 + 𝐶𝑖
𝐴𝑖 =
2
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝐴𝑖
For i=0:
𝑡1 = 𝑡0 + ∆𝑡 = 0 + 0.1 = 0.1
𝐵0 = 𝑓(𝑡0 , 𝑥0 ) = 2𝑡0 − 𝑥0 = 2 × 0 − 1 = −1
𝐵0 + 𝐶0 −1 + (−0.7)
𝐴0 = = = −0.85
2 2
For i=1
𝑡2 = 𝑡1 + ∆𝑡 = 0.1 + 0.1 = 0.2
𝐵1 + 𝐶1 −0.715 + (−0.445)
𝐴1 = = = −0.58
2 2
23
In a tabular form
A comparison between 4th order Runge-Kutta method numerical solution and the
exact solution is shown in Fig. 1.10.
24
b=2;
c=0;
Tf=0.5; %Final time, sec
dt=1e-1; %time Step
%initial conditions
x(1)=1; % initial displacement
x_exact(1)=x(1);
error(1)=abs(x(1)-x_exact(1))/(x_exact(1))*100;
no_data_points=Tf/dt; %number of data points to plot
for i=1:no_data_points
t(i)=(i-1)*dt;
B(i)= a*x(i)+b*t(i)+c;
x_1=x(i)+B(i)*dt;
C(i)= a*x_1+b*(t(i)+dt)+c;
A(i)= (B(i)+C(i))/2;
x(i+1)=x(i)+A(i)*dt;
x_exact(i+1)=3*exp(-(t(i)+dt))+2*(t(i)+dt)-2;
error(i+1)=abs(x_exact(i+1)-x(i+1))/(x_exact(i+1))*100;
end
t(i+1)=(i)*dt;
%plotting
figure(1);plot(t,x,'linewidth', 2);
hold on
figure(1);plot(t,x_exact,'r:','linewidth', 2);
xlabel('Time (sec)','FontSize',12);
ylabel('Displacement (mm)','FontSize',12);
grid on
legend('Heun', 'Exact','location', 'best')
title('Example 2.3 ','FontSize',16);
saveas(gcf, 'Example 2_3.tiff');
Euler's method and the improved Euler's method are the simplest examples of a
whole family of numerical methods to approximate the solutions of differential
equations called Runge-Kutta methods. In this section we will give third and fourth
order Runge-Kutta methods and discuss how Runge-Kutta methods are developed.
Euler's method and the improved Euler's method both try to approximate
Euler's
method approximates the slope of the secant line by the slope of the tangent line at
the left endpoint
The improved Euler's method uses the average of the slopes at the left endpoint and
the approximate right endpoint (that is the right endpoint as computed by Euler's
method) to approximate the slope of the secant line. We don't have to stop there
either. We can keep finding slopes at different points and computing weighted
averages to approximate the slope of the tangent line. Numerical methods to
approximate the solution of differential equations in this fashion are called Runge-
Kutta methods (after the mathematicians Runge and Kutta).
25
This method calculates four slopes, the slope at the beginning, middle and end of the
time step. Then by using the weighted average of the four slopes we will get a better
slope than Euler method.
By considering the following first order ODE:
𝑥𝑖+1 = 𝑥𝑖 +
∆𝑡
(𝑆𝑖,1 + 2𝑆𝑖,2 + 𝑆𝑖,3 + 𝑆𝑖,4 ) (21)
6
where
𝑆𝑖,1 = 𝑓(𝑡𝑖 , 𝑥𝑖 )
∆𝑡 ∆𝑡
𝑆𝑖,2 = 𝑓 (𝑡𝑖 + , 𝑥𝑖 + 𝑆𝑖,1 )
2 2
∆𝑡 ∆𝑡
𝑆𝑖,3 = 𝑓 (𝑡𝑖 + , 𝑥𝑖 + 𝑆𝑖,2 )
2 2
𝑆𝑖,4 = 𝑓(𝑡𝑖 + ∆𝑡, 𝑥𝑖 + ∆𝑡𝑆𝑖,3 )
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝑆𝑖,1 = 𝑓(𝑡𝑖 , 𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 + ∆𝑡𝑄𝑖
26
An example of the first calculation is shown below for i=0
𝑡1 = 𝑡0 + ∆𝑡
𝑆0,1 = 𝑓(𝑡0 , 𝑥0 )
𝑥̃1,3 = 𝑥𝑖 + ∆𝑡 × 𝑆0,3
𝑥1 = 𝑥0 + ∆𝑡𝑄0
The solution was computed by using Matlab software and the response is shown in
Fig. 1.11.
27
Matlab Code for Example 2.4:
28
Comparison of the numerical integration methods
The error percentage for each method is show in the following table
The time response plot for each method is shown in the Fig. 1.12.
Fig. 1.12. Comparison mf the time response for Euler, Heun’s, 4th order Runge-Kutta
and exact solution.
29
8. Numerical Integration of second order DOE
The Euler's, Heun's, Runge-Kutta methods can be applied to first order systems only.
So that it will be necessary to convert the second order vibration equation into two
first order equations. The non-homogeneous differential equation with constant
coefficients of a vibratory system is written as:
𝑥 = 𝑦1 𝑥̇ = 𝑦2 = 𝑦̇ 1 𝑥̈ = 𝑦̇ 2
𝑐 𝑘 𝑓(𝑡)
𝑦̇ 2 = − 𝑦2 − 𝑦1 +
𝑚 𝑚 𝑚
Therefore, we are going to solve the next two first order equations:
𝑦̇ 1 = 𝑦2
𝑐 𝑘 (24)
𝑦̇ 2 = − 𝑦2 − 𝑦1 + 𝑓(𝑡)
𝑚 𝑚
In matrix form:
0 1 𝑦 0
𝑦̇ 1 𝑐 ] [ 1 ] + [𝑓(𝑡)]
[ ]=[ 𝑘 𝑦2
𝑦̇ 2 − −
𝑚 𝑚 𝑚
𝑦̇ = 𝐴𝑦 + 𝐵(𝑡) (25)
𝑦1 (0) 𝑥(0) 𝑥𝑜
𝑦(0) = [ ]=[ ] = [𝑣 ]
𝑦2 (0) 𝑥̇ (0) 𝑜
where
0 1 0
𝐴=[ 𝑘 𝑐 ] , 𝐵 = [𝑓(𝑡)]
− −
𝑚 𝑚 𝑚
30
𝑦̇ 𝑥̇ 𝑦1 𝑥
𝑦̇ = [ 1 ] = [ ] 𝑦 = [𝑦 ] = [ ]
𝑦̇ 2 𝑥̈ 2 𝑥̇
The matrix 𝐴 defined in this way is called the state matrix and the vector 𝑦 is called
the state vector. The position 𝑦1 and the velocity 𝑦1 are called the state variables.
Now the Euler and Range-Kutta methods of numerical solution can be applied to
Eq.25 as follows:
Euler Method
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝑆𝑖 = 𝐴𝑦(𝑖) + 𝐵(𝑡)
(26)
𝑦(𝑖 + 1) = 𝑦(𝑖) + ∆𝑡𝑆𝑖
Runge-Kutta Method
𝑡𝑖+1 = 𝑡𝑖 + ∆𝑡
𝑦̃2 (𝑖 + 1) = 𝑦(𝑖) + 𝑆2 ⁄2
𝑦(𝑖 + 1) = 𝑦(𝑖) + 𝑄𝑖
31
Example 3.1
Solution
3𝑥̈ + 𝑥̇ + 2𝑥 = 0
1 2
𝑥̈ = − 𝑥̇ − 𝑥
3 3
Let
𝑦1 = 𝑥(𝑡) 𝑎𝑛𝑑 𝑦2 = 𝑥̇ (𝑡)
Hence
𝑦̇ 1 = 𝑦2 = 𝑥̇
1 2
𝑦̇ 2 = 𝑥̈ = − 𝑥̇ − 𝑥
3 3
𝑦̇ 1 = 𝑦2 = 𝑥̇
1 2 (28)
𝑦̇ 2 = 𝑥̈ = − 𝑥̇ − 𝑥
3 3
𝑦̇ 𝑥̇ 𝑦1 𝑥
𝑦̇ = [ 1 ] = [ ] 𝑦 = [𝑦 ] = [ ]
𝑦̇ 2 𝑥̈ 2 𝑥̇
In matrix form:
0 1 𝑦
𝑦̇ 1 2 1] [ 1 ] + [0]
[ ]=[ 𝑦2
𝑦̇ 2 − − 0
3 3
𝑦1 (0) 𝑥(0) 𝑥𝑜 0
𝑦(0) = [ ]=[ ] = [𝑣 ] = [ ]
𝑦2 (0) 𝑥̇ (0) 𝑜 0.25
32
where
0 1
𝐴=[ 2 1] , 𝐵 = [0]
− − 0
3 3
Numerical iterations:
Assume ∆𝑡 = 0.01
For 𝑖 = 0:
𝑡1 = 𝑡0 + ∆𝑡 = 0 + 0.01 = 0.01
0 1
𝑓(0, 𝑦(0)) = [ 2 1] 𝑦(0) + [0]
− − 0
3 3
𝑦 (0) 𝑥𝑜 0
𝑦(0) = [ 1 ] = [𝑣 ] = [ ]
𝑦2 (0) 𝑜 0.25
0 1
𝑓(0, 𝑦(0)) = [ 2 1] [ 0 ] + [0]
− − 0.25 0
3 3
0.25
𝑓(0, 𝑦(0)) = [ ]
−0.083
0.25 0.0025
𝑆𝑖,1 = ∆𝑡 × 𝑓(0, 𝑦(0)) = 0.01 × [ ]=[ ]
−0.083 −0.00083
0.00125
𝑦̃1 (1) = [ ]
0.24958
0 1
𝑓(0.005, 𝑦̃1 (1)) = [ 2 1] 𝑦̃1 (1) + + [0]
− − 0
3 3
33
0 1
𝑓(0.005, 𝑦̃1 (1)) = [ 2 1] [0.00125] + [0]
− − 0.24958 0
3 3
0.24958
𝑓(0.005, 𝑦̃1 (1)) = [ ]
−0.084
0.0024958
𝑆𝑖,2 = ∆𝑡 × 𝑓(0.005, 𝑦̃1 (1))=[ ]
−0.00084
0.001248
𝑦̃2 (1) = [ ]
0.24958
0 1
𝑓(0.005, 𝑦̃1 (1)) = [ 2 1] 𝑦̃2 (1) + + [0]
− − 0
3 3
0 1
𝑓(0.005, 𝑦̃1 (1)) = [ 2 1] [0.001248] + [0]
− − 0.24958 0
3 3
0.24958
𝑓(0.005, 𝑦̃1 (1)) = [ ]
−0.084
0.0024958
𝑆𝑖,3 = ∆𝑡 × 𝑓(0.005, 𝑦̃1 (1))=[ ]
−0.00084
0 0.0024958
𝑦̃3 (1) = 𝑦(0) + 𝑆3 = 𝑦(0) + ∆𝑡 × 𝑓(0.005, 𝑦̃1 (1)) = [ ]+[ ]
0.25 −0.00084
0.0025958
𝑦̃3 (1) = [ ]
0.24916
34
0 1
𝑓(0.01, 𝑦̃3 (1)) = [ 2 1] 𝑦̃3 (1) + + [0]
− − 0
3 3
0 1
𝑓(0.01, 𝑦̃3 (1)) = [ 2 1] [0.0025958] + [0]
− − 0.24916 0
3 3
0.24916
𝑓(0.01, 𝑦̃3 (1)) = [ ]
−0.0847
0.0024916
𝑆𝑖,4 = ∆𝑡 × 𝑓(0.05, 𝑦̃3 (1))=[ ]
−0.000847
0.0024958
𝑄1 = [ ]
−0.00084
𝑦(𝑖 + 1) = 𝑦(𝑖) + 𝑄𝑖
𝑦(1) = 𝑦(0) + 𝑄1
0 0.0024958
𝑦(1) = [ ]+[ ]
0.25 −0.00084
0.0024958
𝑦(1) = [ ]
0.24916
The Matlab Code for solving Second order, vibration system ODE of Example 3.1:
%Inputs
m = 3; % mass (Kg)
35
k = 2; % Stiffness (N/mm)
c = 1; % damping coefficient (N.s/mm)
%initial conditions
xo=0; % initial displacement (mm)
vo=0.25; % initial velocity (mm/s)
% time
tf = 20; %(sec)
dt = 0.01; %(sec)
xstate = [xo; vo]; %(mm; mm/sec)
for i=1:tf/dt
t = dt*i;
xstate = RK(xstate);
%results
z(i) = xstate(1); % Displacement(mm)
q(i) = xstate(2); % Velocity(mm/sec)
end
% Calculating Exact Solution
C= c^2-4*m*k;
% Overdamped System C^2>4mk
if C>0
p1= (-c+sqrt(c^2-4*m*k))/(2*m);
p2= (-c-sqrt(c^2-4*m*k))/(2*m);
A1=(xo*p2-vo)/(p2-p1);
A2=(vo-xo*p1)/(p2-p1);
for i=1:tf/dt+1
t1(i)=(i-1)*dt;
x_exact(i)=A1*exp(p1*t1(i))+A2*exp(p2*t1(i));
end
end
% Critically damped System C^2=4mk
if C==0
p1_1= (-c/(2*m));
c1=xo;
c2=vo-xo*p1_1;
for i=1:tf/dt1
t1(i)=(i-1)*dt;
x_exact(i)=(c1+c2*t1(i))*exp(p1_1*t1(i));
end
end
% Undrdamped System C^2<4mk
if C<0
alpha= (-c)/(2*m);
beta= (sqrt(4*m*k-c^2))/(2*m);
X=sqrt(xo^2+((vo-alpha*xo)/beta)^2);
phi=atand((beta*xo)/(vo-alpha*xo));
for i=1:tf/dt+1
t1(i)=(i-1)*dt;
x_exact(i)=X*exp(alpha*t1(i))*sin(beta*t1(i)+phi*pi/180);
36
end
end
%plotting
plot(0:dt:tf,[xo,z],'linewidth', 2);
hold on
plot(t1,x_exact,'r:','linewidth', 2);
xlabel('Time (sec)','FontSize',12); ylabel('Displacement
(mm/sec)','FontSize',12);
title(' Transient Response','FontSize',15)
legend('Numerical', 'Exact','location', 'best')
grid on
saveas(gcf, 'Example 3_1.tiff');
figure(2)
plot(0:dt:tf,[xo,z],'linewidth', 2);
hold on
plot(0:dt:tf,[vo,q],'r:','linewidth', 2); xlabel('Time
(sec)','FontSize',12);
title(' Transient Response','FontSize',15)
legend('Displacement', 'Velocity','location', 'best')
grid on
saveas(gcf, 'Example 3_1_velocity.tiff');
function xstate= RK(xstate)
global dt t t_rk
t_rk=(t-dt);
S1 = dt * x_dot( xstate );
t_rk=(t-dt)+dt/2;
S2 = dt * x_dot( xstate + S1/2);
t_rk=(t-dt)+dt/2;
S3 = dt * x_dot( xstate + S2/2);
t_rk=(t-dt)+dt;
S4 = dt * x_dot( xstate + S3 );
Q=1/6 *(S1 + 2*S2 + 2*S3 + S4);
xstate = xstate + Q;
function xdot=x_dot(X)
global m k c
% forcing function
F_t= force;
A=[0, 1; -k/m, -c/m];
b=[0; F_t/m];
xdot = A*X+b;
function F_of_t =force
global t_rk
F_of_t=0;
% F_of_t=240000*t_rk;
37
The time response is plotted in Fig. 1.13.
It was shown in example 1.5 that the exact solution of this differential equation is
𝑡
𝑥(𝑡) = 0.31𝑒 −6 sin (0.79𝑡)
Runge-Kutta method can be enhanced by treating the time step ∆𝑡 as a variable, ∆𝑡𝑖 .
At each time 𝑡𝑖 , the value of ∆𝑡𝑖 is adjusted based on how rapidly the solution of 𝑥(𝑡)is
changing. If the solution is not changing very rapidly, a large value of ∆𝑡𝑖 is allowed
without increasing the formula error. On the other hand, if 𝑥(𝑡)is changing rapidly, a
small ∆𝑡𝑖 must be chosen to keep the formula error small. Such step sizes can be
chosen automatically as part of the computer code for implementing the numerical
solution.
Matlab has two different Runge-Kutta based simulations: ode23 and ode45. These
are automatic step-size integration methods (i.e., ∆𝑡 is chosen automatically).
% function Ex_3_1_ODE45
function xdot=sdof(t,x)
38
m = 3; % mass (Kg)
k = 2; % Stiffness (N/mm)
c = 1; % damping coefficient (N.s/mm)
xdot=zeros(2,1);
xdot(1)=x(2);
xdot(2)=(-k/m)*x(1)+(-c/m)*x(2);
Fig. 1.14. Time response of example 3.1 by using ode45 Matlab function.
39
Stability of the Vibration Equation
1. Introduction
The differential equations that govern the vibration system is given by:
It has been shown in the preceding analysis that the solution of the vibration
equations consists of two parts; the complementary solution and the particular
solution. In the theory of vibration, the particular solution depends on the external
excitation. In the special case of free vibration, one has to determine only the
complementary solution which contains two arbitrary constants that can be
determined from the initial conditions. As was shown in chapter 2, the
complementary solution depends n the roots of the characteristic equations. These
roots depend on the coefficients of the displacement and its time derivatives in the
differential equation. Consequently, these coefficients, which represent inertia,
damping, and stiffness coefficients, affect the form of the complementary function and
the complete solution of the vibration problem. The stability of the system depends
on the roots of the characteristic equations, 𝑝1 and 𝑝2 . In terms of these roots, the
general form of the complementary solution is given by
𝑥(𝑡) = 𝐴𝑒 𝑝𝑡 (2)
If we substitute with Eq. 2 in Eq. 1 we will get the following characteristic equation
𝑚𝑝2 + 𝑐𝑝 + 𝑘 = 0 (3)
By solving Eq. (3) we will get
−𝑐 + √𝑐 2 − 4𝑚𝑘
𝑝1 = (4)
2𝑚
−𝑐 − √𝑐 2 − 4𝑚𝑘
𝑝2 = (5)
2𝑚
The general solution of the differential equation, provided that the roots of the
differential equation are not equal, can be written as
where 𝐴1 and 𝐴2 are arbitrary constants and 𝑝1 and 𝑝2 are the roots of the
characteristic equation. In the following, we examine the effect of the roots on the
stability of the system.
40
If both the roots 𝑝1and 𝑝2 are real and negative, the solution 𝑥(𝑡) approaches zero as
time 𝑡 becomes large. In this case, the solution is bounded and nonoscillatory. The
rate at which the solution decreases as time increases depends on the magnitude of
the roots p𝑝1and 𝑝2 . It is quite usual to use the complex plane to examine the stability
of the system as shown in Fig. 4.1, in the case of the negative real roots, the roots of
the characteristic equations 𝑝1and 𝑝2 lie on the negative portion of the real axis. The
system can be more stable by increasing the magnitude of the negative roots. This, of
course, can be achieved by changing the inertia, damping, and/or stiffness parameter
of the system.
More staple
p1 p2
Fig. 4.1. Time response of a stable system with negative real roots.
If one of the roots or both become positive, the solution is non oscillatory and grows
without bond as time increases; an increase with time depends on the magnitude of
the positive roots. As the root magnitude increases, the solution grows more rapidly.
This behavior happens, because of the exponential form of the solution. Different
combinations that lead to instability are shown in the complex plane shown in Fig.
4.2.
Complex Roots
In this case, the roots 𝑝1and 𝑝2 appear as a complex conjugates which can be written
as
𝑝1 = 𝛼 + 𝑖𝛽 (7)
𝑝2 = 𝛼 − 𝑖𝛽 (8)
41
p1 p2
p1 p2 p2 p1
Fig. 4.2. Time response of a unstable system with one or two positive real roots.
where 𝑋 and 𝜙 are arbitrary constants which can be determined from the initial
conditions. As shown in the examples presented in the preceding sections, there are
3 possibilities which may be encountered. First, the real part of the root 𝛼 is negative.
In this case, the roots 𝑝1and 𝑝2 are located in the left-hand side o the complex plane,
as shown in Fig. 4.3. As shown in Fig. 4.3, the solution of the vibration equation is
oscillatory and bounded, with an amplitude which decreases with time. The
frequency of the oscillation depends on 𝛽 while the rate of the decay depends on the
magnitude of the real part 𝛼. This is the case of stable system.
The second possibility occurs when the real part 𝛼 is identically zero. In this case, the
roots 𝑝1and 𝑝2 consist of only imaginary parts, as shown n Fig. 4.4. In this case, the
solution is a harmonic oscillation which has a frequency equal to 𝛽, as shown in Fig.
4.4. In this case, the system is called critically stable since the solution is bounded, but
the amplitude does not increase or decrease as time 𝑡 increases.
42
p1
p2
p1
p2
Fig. 4.3. Time response of a critically stable system with complex roots.
p1
p2
43
The third possibility occurs when the real part 𝛼 is positive. In this case, the roots
𝑝1and 𝑝2 are located in the right-hand side of the complex plane, as shown in Fig. 4.5.
The solution, in this case, is a product of an exponential function which grows with
time and a harmonic function which has a constant amplitude. The result is an
oscillatory motion with an amplitude that increases as time increases, as shown in
Fig. 4.5, this is the case of unstable system.
It is clear from the analysis presented in this section, that the stability of motion is
achieved if the roots 𝑝1and 𝑝2 of the characteristic equations lie in the right-hand side
of the complex plane. If any of the roots lie in the right-hand side of the complex plane,
the system becomes unstable. Furthermore, the degree of stability or instability
depends on the magnitude of the roots. The location of the roots of the characteristic
equations can be altered by changing the physical parameters of the system, such as
the inertia, damping, and stiffness coefficients.
44