You are on page 1of 252

Linear Systems Control and Vibrations

for Mechanical Engineers



Dr. Robert L. Williams II
Mechanical Engineering, Ohio University

NotesBook Supplement for
ME 3012 System Vibrations, Analysis, and Control
2014 Dr. Bob Productions

williar4@ohio.edu
www.ohio.edu/people/williar4





These notes supplement the ME 3012 NotesBook by Dr. Bob

This document presents supplemental notes to accompany the ME 3012 NotesBook. The outline
given in the Table of Contents on the next page dovetails with and augments the ME 3012 NotesBook
outline and hence is incomplete here.

2
ME 3012 Supplement Table of Contents

1. INTRODUCTION ................................................................................................................................................................ 3
1.1 CONTROL SYSTEMS AND MECHANICAL VIBRATIONS DEFINITIONS .............................................................................. 3
1.4 MATLAB INTRODUCTION ............................................................................................................................................... 6
2. LINEAR SYSTEM SIMULATION .................................................................................................................................... 7
2.1 SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS .................................................................................................... 7
2.1.1 First-Order ODEs ....................................................................................................................................................... 9
2.1.2 Second-Order ODEs ................................................................................................................................................. 13
2.1.3 MATLAB Functions for ODEs .................................................................................................................................. 18
2.2 THE LAPLACE TRANSFORM ........................................................................................................................................... 19
2.2.2 ODE Solution via Laplace Transforms .................................................................................................................... 21
3. TRANSFER FUNCTIONS AND BLOCK DIAGRAMS ................................................................................................ 22
3.1 TRANSFER FUNCTIONS ................................................................................................................................................... 22
3.2 BLOCK DIAGRAMS .......................................................................................................................................................... 23
3.4 FEEDBACK ...................................................................................................................................................................... 26
3.5 SIMULINK TUTORIAL ..................................................................................................................................................... 27
4. TRANSIENT RESPONSE ................................................................................................................................................. 30
4.1 SECOND-ORDER SYSTEM DAMPING CONDITIONS ........................................................................................................ 30
4.2 SECOND-ORDER SYSTEM PERFORMANCE SPECIFICATIONS ......................................................................................... 38
4.3 OPEN-LOOP AND CLOSED-LOOP SYSTEM EXAMPLE .................................................................................................... 43
4.4 FIRST- AND SECOND-ORDER TRANSIENT RESPONSE CHARACTERISTICS .................................................................... 47
4.5 SYSTEM TYPE ................................................................................................................................................................. 52
4.7 TERM EXAMPLE OPEN-LOOP TRANSIENT RESPONSE .................................................................................................. 53
5. CONTROLLER DESIGN .................................................................................................................................................. 56
5.1 CONTROLLER DESIGN INTRODUCTION ......................................................................................................................... 56
5.2 ROOT-LOCUS METHOD .................................................................................................................................................. 61
5.8 CONTROLLER DESIGN EXAMPLE 2 UNSTABLE G(S) ................................................................................................... 64
5.9 CONTROLLER DESIGN EXAMPLE 3 G(S) WITH A ZERO .............................................................................................. 68
5.10 HIGHER-ORDER SYSTEM CONTROLLER DESIGN ........................................................................................................ 72
5.11 CLOSED-LOOP CONTROLLER INPUT EFFORT ............................................................................................................. 76
5.12 DISTURBANCE EVALUATION AFTER CONTROLLER DESIGN ....................................................................................... 83
5.13 WHOLE T(S) MATCHING CONTROLLER DESIGN THE J-METHOD .......................................................................... 88
5.14 TERM EXAMPLE CONTROLLER DESIGN .................................................................................................................... 103
5.15 TERM EXAMPLE DISTURBANCES AND STEADY-STATE ERROR ................................................................................ 115
6. VIBRATIONAL RESPONSES ........................................................................................................................................ 120
6.1 FREE VIBRATIONAL RESPONSES .................................................................................................................................. 120
6.1.1 Undamped Second-Order System Free Responses: Simple Harmonic Motion ...................................................... 120
6.1.2 Damped Second-Order System Free Responses .................................................................................................... 141
6.2 FORCED VIBRATIONAL RESPONSES ............................................................................................................................. 161
6.2.1 Undamped Second-Order System Harmonically-Forced Responses ..................................................................... 161
6.2.2 Damped Second-Order System Harmonically-Forced Responses ......................................................................... 187
6.2.3 General Forcing Functions .................................................................................................................................... 235
7. HARDWARE CONTROL IN THE OHIO UNIVERSITY ROBOTICS LAB ........................................................... 244
7.1 QUANSER/SIMULINK CONTROLLER ARCHITECTURE ................................................................................................. 244
7.2 PROGRAMMABLE LOGIC CONTROLLER (PLC) ARCHITECTURE ............................................................................... 250

3
1. Introduction

1.1 Control Systems and Mechanical Vibrations Definitions

This section presents some important definitions for linear control systems and mechanical
vibrations concepts, used throughout the ME 3012 NotesBook. You may be familiar with some these
terms if some are unfamiliar, dont panic, we will discuss them later.

control To make an engineering system behave as desired using a sensor, actuator,
and computer software.

controller The software component in a feedback control system that automatically
calculates the actuator input every time cycle to improve the output.

stability A system is said to be stable if its output is bounded for all bounded
inputs.

open-loop A control system that functions without sensor feedback

closed-loop A control system that functions with sensor feedback and a controller

disturbances Unknown, unwanted effects that open-loop and closed-loop control
systems are subjected to in the real world, modeled at the input level.

model The set of ordinary differential equations and algebraic equations that
represents the simplified dynamics of a real-world system.

simulation Solving the model equations and plotting to predict and display the
dynamic motion of the system.

digital A data system that uses discrete values, such as computers.

discrete Discontinuous values.

analog A data system that uses continuous values, such as voltage-based sensors.

continuous Non-discontinuous values.

Laplace transform A mathematical transformation from the time domain to the frequency
domain.

input The external forcing function that drives a dynamic system.

output The variable of interest in motion of a dynamic system.

initial conditions The values of the output variable and its derivatives at t =0. There must
be n initial conditions given where n is the system order.

4
transfer function The Laplace transform of the output of a block divided by the Laplace
transform of the block input, with zero initial conditions.

characteristic polynomial The denominator polynomial of a transfer function, whose order is the
system order. Also appears in ODE solutions.

poles The roots of the transfer function denominator. The roots of the
characteristic polynomial.

zeros The roots of the transfer function numerator

degrees of freedom dof the number of independent parameters required to fully specify the
location of a device. The number of different ways something can move.

dynamics The study of motion with regard to forces/torques.

free-body diagram FBD, a diagram drawn out of context for each separate mass or inertia
with all external and internal forces and moments shown to give context.

cycle A repeating unit of motion.

period T, time for one cycle, sec.

cyclical frequency f, number of cycles per second, the inverse of time period, 1 / T, Hz.

circular frequency 2 f e t = , scalar measure of rotational rate, i.e. the magnitude of the
angular velocity vector, rad/sec.

natural frequency The rate at which an unforced, undamped dynamic system tends to
vibrate, either cyclical frequency f
n
, or circular frequency e
n
.

spring Idealized massless mechanical element that provides the oscillatory
motion in a dynamic system.

dashpot Idealized massless mechanical element that provides the energy
dissipation in a dynamic system.

mass Idealized mechanical element that provides the inertia in a dynamic
system.

mass moment of inertia Idealized mechanical element that provides the rotational inertia in a
dynamic system.

damping A linear model for energy loss due to friction and other energy dissipaters,
for either translational or rotational motion. Damping is provided by a
virtual viscous dashpot (an automotive shock system is a real example).

amplitude The maximum magnitude of a sinusoidal oscillation.

5
differential equation An equation in which the unknown appears with its time derivatives.

initial conditions Given values at time t =0 for the output and its time derivatives. There
must be as many initial conditions as the order of the differential equation.

homogeneous solution Transient solution due to initial conditions and the external input forcing
function, yielding zero in the ODE.

transient solution Dynamic motion that disappears given enough time.

particular solution Steady-state solution due to the external input forcing function. There is
also a transient solution due to the external input forcing function.

steady-state solution Dynamic motion that does not disappear as time increases.

forcing function The input actuation provided by an external source.

damped frequency The rate at which an unforced, damped dynamic system tends to vibrate,
either cyclical f
d
, or circular e
d
.

root locus A plot in the Re-Im plane demonstrating how the closed-loop poles move
as a controller parameter K is varied from zero to infinity.

frequency response The plots of system amplitude and phase angle vs. independent variable
input frequency.


6
Linear System Definition
A linear system is one in which all governing equations (differential, algebraic) are linear.
Linear systems satisfy the principles of linear superposition and homogeneity. Let u(t) be the input
and y(t) be the output. Further, ( ) ( ) u t y t indicates a system yielding output y(t) given input u(t).

1) linear superposition

if
1 1
( ) ( ) u t y t and
2 2
( ) ( ) u t y t then
1 2 1 2
( ) ( ) ( ) ( ) u t u t y t y t + +


2) homogeneity

if ( ) ( ) u t y t then ( ) ( ) au t ay t

where a is any constant.

Examples
linear ODEs
( ) ( ) ( ) ay t by t u t + =
2
( ) 2 ( ) ( ) ( )
n n
y t y t y t u t e e + + =

non-linear ODEs
2
( ) sin ( ) ( ) ay t b y t u t + =
3 2
( ) 2 ( ) cos ( ) ln ( )
n n
y t y t y t u t e e + + =

Almost all real-world systems are non-linear due to Coulomb friction, hysteresis, unmodeled dynamics,
non-linear stiffness, large-angle dynamics, etc.

However, many engineering systems have
- linear operating ranges, or
- equations may be piecewise linearized in various operating regions

Model vs. actual system we use a mathematical model to design the controller, but in the end the
controller will run with an actual system. The controller is a software program, a MATLAB/Simulink
block or blocks, taking sensor feedback from the real world and automatically generating actuator
commands to continuously improve the dynamic performance of the system.


1.4 MATLAB Introduction

MATLAB is a general engineering analysis and simulation software. MATLAB stands for
MATrix LABoratory. It was originally developed specifically for control systems simulation and
design engineering, but it has grown over the years to cover many engineering and scientific fields.
MATLAB is based on the C language, and its programming is vaguely C-like, but simpler. MATLAB is
sold by Mathworks Inc. (mathworks.com) and Ohio University has a site license. For an extensive
introduction to the MATLAB software, see Dr. Bobs MATLAB Primer:

www.ohio.edu/people/williar4/html/PDF/MATLABPrimer.pdf

7
2. Linear System Simulation

2.1 Solution of Ordinary Differential Equations

Simulation means solving linear constant-coefficient ordinary differential equations, subject to
the given initial conditions (ICs). We must solve and plot the system response (output vs. time) given
the input forcing function and the initial conditions. We will consider first- and second-order ODEs.
The number of initial conditions must equal the ODE order.

e.g. Solve
2 1 0
( ) ( ) ( ) ( ) a x t a x t a x t r t + + = for x(t)

Given the input forcing function r(t) and subject to the initial conditions
0
0
(0)
(0)
x x
x v
=
=
.

General Solution Methods
- Slow ME Way
- Laplace Transforms

Slow ME Way

total solution = homogeneous solution + particular solution
transient response to ICs steady-state response to input

1. Homogeneous Solution transient response to initial conditions (0), (0) x x

This method works for ODEs of any order it is demonstrated for the second-order ODE above.

2 1 0
( ) ( ) ( ) 0
H H H
a x t a x t a x t + + =

Assume: ( )
st
H
x t Ae =

Substitute
2
( )
( )
( )
st
H
st
H
st
H
x t Ae
x t sAe
x t s Ae
=
=
=

into
2 1 0
( ) ( ) ( ) 0
H H H
a x t a x t a x t + + =

Calculate s
i
the roots of the n
th
-order polynomial in s (called the system characteristic polynomial)

The general homogeneous solution form must have n terms. For the second-order case:

1 2
1 2
( )
s t s t
H
x t A e A e = +


Substitute the specific s
i
roots at this stage, but leave the A
i
coefficients unknown for now (there are n of
each of these, n =2 in this example).
8
2. Particular Solution steady-state response to input forcing function r(t)

2 1 0
( ) ( ) ( ) ( )
P P P
a x t a x t a x t r t + + =

Assume x
P
(t) according to the same form as the input forcing function r(t).


Table of Particular Solution Forms

r(t) x
P
(t)
constant different constant
t B
1
t +B
2

t
2
B
1
t
2
+B
2
t + B
3

cos D t e
1 2
cos sin B t B t e e +
sin D t e
1 2
cos sin B t B t e e +
etc. etc.


Method of Undetermined Coefficients

Determine the unknown coefficients B
i
:

Substitute ( ), ( ), ( )
P P P
x t x t x t into
2 1 0
( ) ( ) ( ) ( )
P P P
a x t a x t a x t r t + + =

and solve for the unknown coefficients B
i
right away.



3. Total Solution

( ) ( ) ( ) ( )
T H P
x t x t x t x t = = +

Now determine the unknown homogeneous coefficients A
i
using the initial conditions on x
T
(t).


#of characteristic polynomial roots = #of initial conditions =ODE order =n

9
2.1.1 First-Order ODEs

First-Order System Example 2
Same ck system and initial condition, but ( ) 5sin2 f t t =
Solve ( ) 50 ( ) 5sin2 x t x t t + = subject to x(0) =0

Solution
( )
50
5
( ) 25sin2 cos2
1252
t
x t e t t

= +

Equivalent alternate solution form
( ) ( )
50
5
( ) 25.02sin 2 0.04
1252
t
x t e t

= + using sin( ) sin cos cos sin a b a b a b =




- The response x(t) starts at zero as specified by the initial condition.
- The transient solution goes to zero by about t =0.10 sec.
- Steady-state solution is ( ) ( ) 25.02sin 2 0.04
ss
x t t = m.
- e =2 rad/s e =2tf f =1/t =1/T T =t sec

0 1 2 3 4 5 6 7 8
-0.1
-0.08
-0.06
-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1
t (sec)
-5/1252 cos(2 t)+125/1252 sin(2 t)+5/1252 exp(-50 t)
x
(
t
)

(
m
)
10
Alternate form for particular solution (Example 2)

Sum-of-angles formulae
cos( ) cos cos sin sin
sin( ) sin cos cos sin
a b a b a b
a b a b c a b
=
=



( )
25sin2 cos2 sin(2 )
sin2 cos cos2 sin
t t C t
C t t
|
| |
=
=


sin2 25 cos
cos2 1 sin
t C
t C
|
|
=
=


( )
2 2 2 2 2
cos sin 25 1 C | | + = + 626 25.02 C = =

sin 1
cos 25
|
|
=
1
1
tan 0.04
25
|

| |
= =
|
\ .
rad

( ) 25sin2 cos2 25.02sin 2 0.04 t t t =

In general:
2 2
1 2
C B B = +
1 2
1
tan
B
B
|

| |
=
|
\ .
when
( )
1 2
( ) sin2 cos2
sin 2
P
x t B t B t
C t |
= +
=



11
A Final First-Order ODE example R, C series electrical circuit (voltage v(t) input, current i(t) output)


Model (from KVL and electrical circuit element table)
1
( ) ( ) ( ) Ri t i t dt v t
C
+ =
}


substitute charge q(t)
( ) ( )
( ) ( )
i t dt q t
i t q t
=
=
}


1
( ) ( ) ( ) Rq t q t v t
C
+ =

Given R =50 O and C =0.2 mF, solve 50 ( ) 5000 ( ) 1 q t q t + = subject to (0) 0 q = and a unit step voltage
input v(t). Solution
( )
100
1
( ) 1
5000
t
q t e

=
100
1
( ) ( )
50
t
i t q t e

= =



- As expected from the circuit dynamics, the charge q(t) in the capacitor builds up to a constant
given a constant voltage input.
- Also as expected, the capacitor current i(t) goes to zero at steady-state.
- The steady state charge value is q
SS
=1/5000.
- The time constant is t =RC =0.01, so at 3 time constants (t =0.03 sec) both the q(t) and i(t)
values have approached 95% of their respective final values.
v(t)
R
+
-
i(t)
C
0 0.01 0.02 0.03 0.04 0.05 0.06
0
0.5
1
1.5
2
x 10
-4
q
(
t
)
0 0.01 0.02 0.03 0.04 0.05 0.06
0
0.005
0.01
0.015
0.02
i
(
t
)
t (sec)
12
First-Order System Examples
c, k massless translational mechanical system
force input f(t) and displacement output x(t)
( ) ( ) ( ) cx t kx t f t + =

m, c springless translational mechanical system
force input f(t) and velocity output v(t)
( ) ( ) ( ) ( ) ( ) mx t cx t mv t cv t f t + = + =

c
R
, k
R
massless rotational mechanical system
torque input t(t) and angular displacement output u(t)
( ) ( ) ( )
R R
c t k t t u u t + =



J, c
R
springless rotational mechanical system
DC servomotor, torque input t(t) and angular velocity output e(t)
( ) ( ) ( ) ( ) ( )
R R
J t c t J t c t t u u e e t + = + =



L, R series electrical circuit
voltage input v(t) and current output i(t)
( )
( ) ( )
di t
L Ri t v t
dt
+ =

R, C series electrical circuit
voltage input v(t) and current output i(t), or charge ( ) ( ) q t i t dt =
}

1 1
( ) ( ) ( ) ( ) ( ) Ri t i t dt Rq t q t v t
C C
+ = + =
}



The time constants for these 6 examples are
1
R
R R
c c m J L RC
k c k c R
t
All first-order ODEs are solved in the same way as Example 1 (assuming a unit step input), all
have the same type of time response graph, all share the same time constant behavior (after three time
constants 3t the output response is within 95% of its final value).
Some first-order system models are given in:
www.ohio.edu/people/williar4/html/PDF/ModelTFAtlas.pdf.
f(t)
x(t)
c
k
f(t)
x(t)
m
c
k
(t)
R
u (t) t
cR
J
(t) u (t) t
cR
v(t) L
R
+
-
i(t)
v(t)
R
+
-
i(t) C
13
2.1.2 Second-Order ODEs

Derivation of underdamped homogeneous solution form

In this case we have complex conjugate characteristic polynomial roots
1,2
s a bi = .

For this example assume
1,2
1 3 s i = as in the Section 2.1.2 ME 3012 NotesBook example.


Eulers identity must be used
cos sin
cos( ) sin( ) cos( ) sin( )
i
i
e i
e i i
u
u
u u
u u u u

= +
= + =



( )
( ) ( ) ( )
1 2
1 2
( 1 3 ) ( 1 3 )
1 2
3 3
1 2
1 2
( )
cos3 sin3 cos3 sin3
s t s t
H
i t i t
t it it
t
x t Ae A e
Ae A e
e Ae A e
e A t i t A t i t
+

= +
= +
= +
= + +


where we used u =3t in Eulers identify. Simplifying by collecting (factoring) terms.

( ) ( ) ( )
1 2 1 2
( ) cos3 sin3
t
H
x t e A A t A A i t

= + +

Let
( )
1 1 2
2 1 2
B A A
B A A i
= +
=


We can only have real solutions when starting with real ODE coefficients, so
*
1 2
A A = (these constants
must be complex conjugates of each other).

1
2
RE IM
RE IM
A A A i
A A A i
= +
=

1
2
2
2
RE
IM
B A
B A
=
=



Therefore ( )
1 2
( ) cos3 sin3
t
H
x t e B t B t

= +
B
i
are the real constant unknown homogeneous solution coefficients

And the general underdamped homogeneous solution form given
1,2
s a bi = is:
( )
1 2
( ) cos sin
at
H
x t e B bt B bt = +

That is, the real part of the poles is placed in the exponential and the imaginary part of the poles is
placed as the circular frequency of the cos and sin functions.

14
Second-Order System Example 1

m =1 kg, c =7 Ns/m, k =12 N/m

Solve ( ) 7 ( ) 12 ( ) ( ) 3 ( ) x t x t x t f t u t + + = = subject to
(0) 0.10
(0) 0.05 /
x m
x m s
=
=



This system is overdamped
Real distinct roots, relatively slower response, no overshoot



This solution is left to the interested reader.
15
Second-Order System Example 2
m =1 kg, c =6 Ns/m, k =9 N/m
Solve ( ) 6 ( ) 9 ( ) ( ) 3 ( ) x t x t x t f t u t + + = =
Subject to
(0) 0.10
(0) 0.05 /
x m
x m s
=
=


1. Homogeneous Solution ( ) 6 ( ) 9 ( ) 0
H H H
x t x t x t + + =

Assume ( )
st
H
x t Ae =
2
( 6 9) 0
st
s s Ae + + =

Characteristic polynomial
2 2
6 9 ( 3) 0 s s s + + = + =

1,2
3, 3 s = Real, repeated roots

Homogeneous solution form
3 3
1 2
( )
t t
H
x t A e A te

= +


2. Particular Solution ( ) 6 ( ) 9 ( ) 3
P P P
x t x t x t + + =

( )
P
x t B = 0 6(0) 9 3 B + + = so ( ) 1/3
P
x t B = =


3. Total Solution
3 3
1 2
3 3 3
1 2 2
( ) ( ) ( ) 1/3
( ) 3 3
t t
H P
t t t
x t x t x t Ae A te
x t Ae A e A te


= + = + +
= +


Now apply initial conditions
1 2
1 2
(0) 0.10 (0) 0.33
(0) 0.05 3
x A A
x A A
= = + +
= = +


1
2
0.233
0.65
A
A
=
=


3
( ) (0.233 0.65 ) 0.33
t
x t t e

= + +

This system is critically-damped
Real, repeated roots fastest response without overshoot

Check solution
Plug answer x(t) plus its two derivatives into the original ODE. Also check the initial conditions.

Plot check transient and steady state solutions, plus total solution.
16
Second-Order System Example 2 Forced m-c-k System

Model ( ) ( ) ( ) ( ) mx t cx t kx t f t + + =

( ) 6 ( ) 9 ( ) 3 ( ) x t x t x t u t + + =
(0) 0.10
(0) 0.05 /
x m
x m s
=
=


2 2
6 9 ( 3) 0 s s s + + = + =

Solution
3
1
( ) (0.233 0.65)
3
t
x t t e

= + +

Plot of x(t) vs. t


- The total solution x(t) starts at 0.1 m, ( ) x t is non-zero, as specified by the initial conditions.
- Transient approaches zero after t =2.5 sec
- Critically damped; 3 root goes to zero slightly faster alone than with t
- Steady-state value is x
SS
=1/3 m.
0 1 2 3 4
-0.2
-0.1
0
0.1
0.2
0.3
0.4
t (sec)
x
(
t
)
17
Second-Order System Example 4: Forced m-k System

Model ( ) ( ) ( ) mx t kx t f t + = (no damping)

( ) 9 ( ) 3 ( ) x t x t u t + =
(0) 0.10
(0) 0.05 /
x m
x m s
=
=


2
9 ( 3)( 3) 0 s s i s i + = + =

Solution ( ) (730)cos3 (160)sin3 13 x t t t = + +

Plot of x(t) vs. t


- x(t) starts at 0.1 m, ( ) x t is non-zero, as specified by the initial conditions.
- Simple harmonic motion
- Undamped; zero viscous damping coefficient
- Transient solution oscillates forever about the particular solution 1/3
- e =3 rad/s e =2tf f =3/2t =1/T T =2t/3 =2.09 sec

This system is undamped
Complex-conjugate roots with 0 real part, simple harmonic motion, no damping, theoretically
never stops vibrating.


18
2.1.3 MATLAB Functions for ODEs
In solving ODEs the slow ME way, we have to do the work manually, so MATLAB doesnt help
all that much (with the exception of symbolic MATLAB, see dsolve below). We can find the roots of
the characteristic equation; the remaining code below plots the results that were obtained manually.

cl c; cl ear ;
char = [ 1 2 10] ; % Char act er i st i c pol ynomi al and r oot s
s = r oot s( char ) ;

% Pl ot second- or der syst emsol ut i on r esul t s
Tee = i nput ( ' Ent er [ i ni t i al , del t a, and f i nal t i mes ( sec) ] : ' ) ;
t 0 = Tee( 1) ; dt = Tee( 2) ; t f = Tee( 3) ;
t =[ t 0: dt : t f ] ;
x = - exp( - t ) . *( 0. 20*cos( 3*t ) +0. 05*si n( 3*t ) ) + 0. 30;
ss = 0. 3*ones( si ze( t ) ) ; % St eady- st at e sol ut i on
f i gur e;
pl ot ( t , x, t , ss, ' : ' ) ; gr i d;
set ( gca, ' Font Si ze' , 18) ;
axi s( [ t 0 t f 0 0. 4] ) ;
xl abel ( ' t i me' ) ; yl abel ( ' X( t ) ' ) ;

Other MATLAB ODE-related functions
dsolve symbolic ODE solution (see below)
ode45 numerical ODE solution using 4
th
/5
th
order Runge-Kutta method

After we get into Laplace Transforms, we will learn other useful MATLAB functions for ODE solution.

ODE solution via symbolic MATLAB function dsolve
The MATLAB code below shows how to analytically solve first- and second-order ODEs (first-
order ODE Example 1 and second-order ODE Example 3), using MATLAB function dsolve, display
the analytical solution results to the screen, and then plot results using MATLAB function ezplot
(which reverses the input data compared to most MATLAB plot commands).
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Anal yt i cal sol ut i on f or ODEs usi ng symbol i c MATLAB
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c; cl ear ;
x1 = dsol ve( ' Dx+50*x=5' , ' x( 0) =0' ) ;
pr et t y( x1)
f i gur e;
t 1 = [ 0: 0. 001: 0. 16] ;
ezpl ot ( x1, t 1) ; gr i d; axi s( [ 0 0. 16 0 0. 105] ) ;
x2 = dsol ve( ' D2x+2*Dx+10*x=3' , ' Dx( 0) =0. 05' , ' x( 0) =0. 10' ) ;
pr et t y( x2)
f i gur e;
t 2 = [ 0: 0. 01: 6] ;
ezpl ot ( x2, t 2) ; gr i d; axi s( [ 0 6 0 0. 4] ) ;

19
2.2 The Laplace Transform

Partial Laplace Transform Table


f(t)


F(s)

1

Dirac delta o(t)

1
2 unit step u(t)
1
s

3 unit ramp r(t) =t
2
1
s

4
t
n

n
s
n
!
+1

5
e
at

1
( ) s a +

6
1
at
e


( )
a
s s a +

7
1
( ) ( )
at bt
e e
ab a a b b b a

+ +


1
( )( ) s s a s b + +
a b =
8
n at
t e

1
!
( )
n
n
s a
+
+

9 sin t e

e
e s
2 2
+


10 coset

s
s
2 2
+ e


11
e t
at
sine

2 2
( ) s a
e
e + +


12
e t
at
cose

2 2
( )
s a
s a e
+
+ +




20

Partial Laplace Transform Table (continued)


f(t)


F(s)

13
cos sin
at
b a
e t t e e
e

( | |
+
| (
\ .



2 2
( )
s b
s a e
+
+ +


14
2 2
( )
sin( )
at
b a
e t
e
e |
e

+
+
1
tan
b a
e
|

=



2 2
( )
s b
s a e
+
+ +


15 2
sin
1
n
t n
d
e t
e
e
e

;
2
1
d n
e e = ; 0 1 < <

2
2 2
2
n
n n
s s
e
e e + +


16 2
1 sin( )
1
n
t
d
e
t
e
e |

;
1
cos |

= ; 0 1 < <

2
2 2
( 2 )
n
n n
s s s
e
e e + +


17

2 2
2 2
1
sin( )
at
e
t
a
a
e |
e
e e

+
+
+
;
1
tan
a
e
|

| |
=
|

\ .



2 2
1
[( ) ] s s a e + +


18

2 2
2 2 2 2
1 ( )
sin( )
at
b b a
e t
a a
e
e |
e e e

+
+ +
+ +

1 1
tan tan
b a a
e e
|

| | | |
=
| |

\ . \ .


2 2
[( ) ]
s b
s s a e
+
+ +



21
2.2.2 ODE Solution via Laplace Transforms
This subsection presents an alternate solution for the first-order ODE problem from the ME 3012
NotesBook. Again, this ODE is solved using the Laplace Transform method but now, if we have a
Laplace Transform table of sufficient detail, as on the preceding pages, we can skip the partial fraction
expansion step and use the table directly.

ODE Solution via Laplace Transforms Examples

First-Order ck mechanical system Example 1
Solve ( ) 50 ( ) 5 x t x t + = for x(t), subject to x(0) =0 and a step input of magnitude 5.

We did this ODE solution via the slow ME way and the Laplace Transform method with partial fraction
expansion.


Take the Laplace transform of both sides (dont forget the initial condition but it is given as zero).
| |
5
( ) (0) 50 ( )
5
( ) 50 ( )
sX s x X s
s
sX s X s
s
+ =
+ =


Solve for the variable of interest, X(s), which is the Laplace transform of the answer x(t).
5
( 50) ( )
5
( )
( 50)
s X s
s
X s
s s
+ =
=
+


Up to this point the solution is identical to that in the ME 3012 NotesBook. But now we can skip the
partial fraction expansion if we use the following Laplace Transform table entry.
( )
( )
a
F s
s s a
=
+
( ) 1
at
f t e

=


We must algebraically modify X(s) so that the same constant a appears in the numerator and
denominator, by multiplying by 1 (10/10).
10 5 1 50
( )
10 ( 50) 10 ( 50)
X s
s s s s
| | | |
= =
| |
+ +
\ . \ .


Taking the inverse Laplace transform of X(s) yields the solution x(t).
{ }
1 1 1
50
1 50 1 50
( ) ( )
10 ( 50) 10 ( 50)
1
( ) (1 )
10
t
x t X s
s s s s
x t e

| | | |
= = =
` `
| |
+ +
\ . \ . ) )
=



This is the same solution obtained twice previously.

22
3. Transfer Functions and Block Diagrams

3.1 Transfer Functions

Additional Transfer Function Example

4. R-L-C Parallel Electrical Circuit



Model:
( ) 1 1
( ) ( ) ( )
dv t
C v t v t dt i t
dt R L
+ + =
}



input: current i(t) output: voltage v(t)


Open-loop transfer function :

2
( ) 1 1
( ) ( ) ( )
1 1 ( )
( ) ( ) ( )
1 1
( ) ( )
( ) 1
( )
1 1 1 1
( )
dv t
C v t v t dt i t
dt R L
V s
CsV s V s I s
R L s
Cs V s I s
R Ls
V s s
G s
I s
Cs Cs s
R Ls R L

+ + =
`
)
+ + =
(
+ + =
(

= = =
+ + + +
}




Open-loop block diagram


i(t) R L C v(t)
+
-
i (t)
L
23
3.2 Block Diagrams

Method to define transfer functions in MATLAB

Define polynomials via an array using square brackets with the numerical polynomial
coefficients given in descending power of s. See denG below.

Define the numerator and denominator polynomials num and den for your transfer function;
then use:

SysName = tf(num,den); % define transfer function in MATLAB

to define the transfer function in MATLAB. You then use the name SysName in various MATLAB
functions that require a transfer function as one of its inputs.

Examples
2
1
( )
2 8
G s
s s
=
+ +

1
( )
2
C
s
G s
s
+
=
+

1
( )
3
H s
s
=
+


numG = [1];
denG = [1 2 8];
sysG = tf(numG,denG);

numGc = [1 1];
denGc = [1 2];
sysGc = tf(numGc,denGc);

numH = [1];
denH = [1 3];
sysH = tf(numH,denH);

24
MATLAB to reduce block diagrams to one transfer function
[num,den] = zp2tf(Z,P,K); % convert zero-pole to transfer function
[Z,P,K] = tf2zp(num,den); % convert transfer function to zero-pole
Z zeros
P poles
K scalar gain
num,den transfer function numerator and denominator

[num,den] = series(num1,den1,num2,den2); % series connection of two systems
or [sys] = series(sys1,sys2);

sysi = tf(numi,deni) % transfer function description of block i

[sysT]=feedback(sys1,sys2,sign) % close the feedback loop determine T(s)
sys1 = tf(num1,den1); % transfer function for G
C
(s) G(s)
sys2 = tf(num2,den2); % transfer function H(s)
sign: +1 for positive feedback, 1 for negative (the default)
Make sure you can do each of these by hand!

Methods to solve ODEs
- Slow ME way, Laplace Transforms
- MATLAB dsolve analytical
- MATLAB numerical solutions: impulse, step, lsim, ode45

MATLAB functions to numerically solve ODEs
impulse impulse response of continuous-time linear systems
1. impulse(SysName); % plots to screen
2. impulse(SysName,T); % plots to screen, user controls time T
3. [Y,X] = impulse(SysName); % saves to [ Y, X] for plotting later
4. [Y,T,X] = impulse(SysName,T); % same as 3, user controls time T
where:
SysName=tf(num,den) name for transfer function-based system
num,den transfer function numerator and denominator
T = [t0:dt:tf]; evenly-spaced, user-supplied time array
Y output
X system state ( , Y Y

stored column-wise)

step step response of continuous-time linear systems
step(SysName); % same options and terms as impulse

lsim simulation of continuous-time linear systems for any general given input
lsim(SysName,U,T); plots to screen
[Y,X] = lsim(SysName,U,T,X0); % saves to [ Y, X] for plotting later
U given input, same length as T
X0 initial conditions

25
Simulink model and plots for the Example of Section 3.2


Open-loop Closed-loop

See the following pages for a Simulink tutorial to get you started.

Step Ydes
Step U
Step
Responses
1
s+3
H
s+1
s+2
Gc
1
s +2s+8
2
G Open
1
s +2s+8
2
G
Ydes E U Closed Yact
Yact
Yact
Ysens
U Y Open
26
3.4 Feedback

Four reasons for using feedback

1. To modify the transient response of the system. We can change open-loop poles to closed-loop
poles with more desirable behavior to ensure stability and modify the system transient
performance.


2. To reduce steady-state error in the system.


3. To decrease the sensitivity of the closed-loop system to variations in the open-loop plant transfer
function. Sensitivity is like a derivative
( )
( )
T s
G s
A
A
.


4. To reduce the effects of disturbances, unmodeled dynamics, uncertainties, nonlinearities,
parameters changing with time, and noise. To increase system robustness.


Feedback is not free. A closed-loop feedback system is more expensive and complex, and thus
less reliable, than an open-loop system. Therefore, the engineer must determine if closed-loop feedback
control is justified or if the open-loop system can perform adequately.

There are a host of real-world dynamic systems which demand closed-loop feedback control.


27
3.5 Simulink Tutorial

Simulink is the Graphical User Interface (GUI) for MATLAB. This section presents a brief
tutorial on how to use simulink to create an open-loop block diagram. Then the model can easily be
run, i.e. asking simulink to numerically solve the associated IVP ODE for you and plot the results vs.
time.

1. Start MATLAB and at the prompt type simulink (all lower case).

2. If installed, the Simulink Library Browser will soon pop up.

3. Click on the new icon, identical to a MS Word new file icon. That is your space to work in. After
creating a model it can be saved (using the save icon).

4. To build simulation models, you will be creating block diagrams just like we draw by hand. In
general all blocks are double-clickable to change the values within. In general you can connect
the ports on each block via arrows easily via clicking and dragging with the mouse. You can also
double-click any arrow (these are the controls variables) to label what it is. Same with all block
labels (simulink will give a default name that you can change).

5. simulink uses EE lingo. Sources are inputs and sinks are outputs. If you click around in the
Simulink Library Browser, you will see the possible sources, blocks, and sinks you have at your
disposal.

6. Now let us create a simple one-block transfer function and simulate it subject to a unit step input.
The given open-loop transfer function is
2
1
( )
2 8
G s
s s
=
+ +
.

a. Click the new icon in the Simulink Library Browser to get a window to work in
(untitled with the simulink logo).

b. Double-click the Continuous button in the Simulink Library Browser to see what
blocks are provided for continuous control systems. Grab and slide the Transfer Fcn
block to your workspace. Double-click the block in your workspace and enter [1] in
Numerator coefficients and [1 2 8] in Denominator coefficients and close by
clicking OK. Simulink will update the transfer function in the block, both
mathematically and visually.

c. Go ahead and save your model on your flash drive as name.mdl (whatever name you
want, as long as it is not a reserved MATLAB word).

d. Click the Sources tab in the Simulink Library Browser to see what source blocks are
provided. You will find a Step, Ramp, Since Wave, etc. (but no Dirac Delta see Dr.
Bobs on-line ME 3012 NotesBook Supplement to see how to make that type on input in
Simulink, two methods). Grab and slide the Step block to your workspace. Double-click
the Step block in your workspace and ensure 1 is entered as the final value (for a unit
step) and that 0 is the Initial value. Close by clicking OK.

28
e. Draw an arrow from the Step block to the Transfer Fcn block by using the mouse. Float
the mouse near the Step port (>symbol) and you will get a large +mouse avatar. Click
and drag to the input port of the Transfer Fcn block; when you see a double-plus, let go
and the arrow will be connected.

f. Click the Sinks tab in the Simulink Library Browser to see what sink blocks are
provided. Grab and slide the Scope block to your workspace.

g. Draw an arrow from the Transfer Fcn block to the Scope block by using the mouse, the
same method as before.

h. To run the model (solve the associated differential equation numerically and plot the
output results vs. time automatically), simply push play (the solid black triangle button
in your workspace window).

i. After it runs, double-click on your Scope to display the results. Click the binoculars icon
to zoom in automatically.

j. When I perform these steps, there are two immediate problems: i. the plot does not start
until t =1 sec and ii. the plot is too choppy. These are easy to fix:

i. Double-click the Step block and change the Start time to 0 from the default 1 sec,
then click OK. Re-run and ensure the plot now starts at t =0.

ii. In your workspace window click Simulation ->Configuration Parameters ->Data
Import/Export. Look for Refine output in the window and change the Refine
factor from 1 to 10, then click OK. Re-run and ensure the plot is now acceptably
smooth.

k. Finally in this open-loop simulation example, it appears that 10 sec final time is a bit too
much. Near the play button in your workspace is an unidentified number 10.0. This is
the default final time. Change it to 8.0, re-run, and ensure the plot now ends at t =8. If
you reduce final time less than 8.0 you will lose some transient response detail.

Your final model will look like this (be sure to be a control freak like Dr. Bob and line up all the
arrows and blocks in a rectangular grid). I also renamed the blocks and labeled the variables.




Open-loop simulation example Simulink model


unit step
time response
plot
1
s +2s+8
2
OL system
input u output y
29
Feel free to play around to your hearts content and see what you can learn. Simulink is fast,
easy, and fun! But it is a bad black box on top of the black box of MATLAB.

Another group of simulink blocks you may use a lot is under Math Operations in the Simulink
Library Browser. In particular, we use the Sum (summing junction) and Gain (multiplication by a
constant) a lot in controls.

In addition I find the Mux (multiplexer) and Demux (demultiplexer) very useful, especially the
Mux to combine two or more variables for plotting on a common scope. These are found under Signal
Routing in the Simulink Library Browser.


Assignment: update your above model by yourself to include negative unity feedback (sensor
transfer H(s) =1), with no specific controller (G
C
(s) =1, just a straight line with no block). Plot both
open- and closed-loop unit step responses and compare and discuss.

Hint: put a summing junction between the Step input and the OL system transfer function.
Double-click the sum to make the correct signs (i.e. +and -). Then pull an arrow down from the negative
summing port, turn the corner without letting go. Then you will have to let go, but click immediately
without moving the mouse and hover it over the output y line. When you get the double-plus, let go and
you have just made a pickoff point, for the output y feedback.

30
4. Transient Response

4.1 Second-Order System Damping Conditions

Here is the MATLAB program to create the figure for the example of Section 4.1, comparing the
overdamped, critically-damped, underdamped, and undamped second-order system responses to a unit
step input.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Over - , Cr i t i cal l y, Under - , and Undamped cases usi ng st ep f unct i on
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl ear ; cl c;

num= [ 1] ;
denOVER = [ 1 6 4] ; %Over damped
denCRI T = [ 1 4 4] ; %Cr i t i cal l y- damped
denUNDR = [ 1 2 4] ; %Under damped
denUN = [ 1 0 4] ; %Undamped

pol esOVER = r oot s( denOVER) ; %Pol es f or each case
pol esCRI T = r oot s( denCRI T) ;
pol esUNDR = r oot s( denUNDR) ;
pol esUN = r oot s( denUN) ;

OVER = t f ( num, denOVER) ;
CRI T = t f ( num, denCRI T) ;
UNDR = t f ( num, denUNDR) ;
UN = t f ( num, denUN) ;

t = [ 0: 0. 01: 8] ;
[ yOVER, xOVER] = st ep( OVER, t ) ; %Uni t st ep r esponses
[ yCRI T, xCRI T] = st ep( CRI T, t ) ;
[ yUNDR, xUNDR] = st ep( UNDR, t ) ;
[ yUN, xUN] = st ep( UN, t ) ;

f i gur e;
pl ot ( t , yOVER, ' r ' , t , yCRI T, ' g' , t , yUNDR, ' b' , t , yUN, ' m' ) ; %Pl ot uni t st ep r esponses
set ( gca, ' Font Si ze' , 18) ;
gr i d; yl abel ( ' \ i t y( t ) ' ) ; xl abel ( ' \ i t t ( \ i t sec) ' ) ;
l egend( ' Over ' , ' Cr i t ' , ' Under ' , ' Un' ) ;


31
Over-, Critically-, Under-, and Un-damped Examples using impulse

Solve
( ) 6 ( ) 4 ( ) ( )
( ) 4 ( ) 4 ( ) ( )
( ) 2 ( ) 4 ( ) ( )
( ) 0 ( ) 4 ( ) ( )
y t y t y t t
y t y t y t t
y t y t y t t
y t y t y t t
o
o
o
o
+ + =
+ + =
+ + =
+ + =





for y(t), all subject to zero initial conditions
(0) 0
(0) 0
y
y
=
=
and an impulse input.
For the impulse responses, solve the same ODEs as the step examples in the ME 3012
NotesBook, subject to zero initial conditions and impulse input o(t). Note that though we specified zero
initial conditions (0) 0 y =

and (0) 0 y = , for the impulse responses only the y(0) initial condition can be
satisfied, i.e. all (0) y initial velocities take their own value, different from zero as seen below.

Impulse responses plot


The impulse input final value is 0. Why are the slopes non-zero at t =0? See Section 4.4 in this
Supplement.

The above figure was generated using the same MATLAB program as given above, but
substituting MATLAB function impulse for step.

0 1 2 3 4 5 6 7 8
-0.5
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
0.4
0.5
y
(
t
)
t (sec)


Over
Crit
Under
Un
32
MATLAB Simulink

MATLAB has a powerful graphical user interface (GUI) called Simulink. From the MATLAB
command window type simulink and you can create and simulate any control system described by
block diagrams and transfer functions. Look around to find the transfer function, step input, and scope
(plot) output blocks. Simply drag and drop the desired block to the Simulink workspace. Double-click
on any block to change its parameters. Connect blocks with lines using the mouse/cursor. Simply press
the play button to run your model. Its fast, fun, and addicting! Make sure you can do the steps by
hand, but you are free to use this tool for homework.

For example, the Simulink diagram below recreates the unit step responses for the overdamped,
critically-damped, underdamped, and undamped second-order system example of Section 4.1. All
transfer functions are fed by the same Step input. The mux, or multiplexer, block is used to compare 4
results in one plot, in this case combining 4 scalar signals to one vector signal, to send to the Plots
scope. The resulting plot is identical in form to that shown in the ME 3012 NotesBook, though the
Simulink graphics do not look as nice.





A Simulink tutorial is given in Section 3.5 of this ME 3012 NotesBook Supplement.


33
Impulse Input in Simulink

One can simulate the impulse responses in Simulink also. Since there is no Impulse input
block, we must create our own impulse input. There are three possible methods.

1. The Dirac Delta impulse input o(t) should have infinite magnitude but infinitesimal duration. It is
normalized in the sense that
( ) 1 t o =
}
, i.e. the area under the curve is 1. One way to approximate the
impulse input o(t) is to turn on a step input at t =0 with a large magnitude M and then subtract from this
step input another of equal magnitude M, starting at time At =1/M sec, as shown in the figure below. I
have had success with M =1000 and 10000, among others. Be sure to scope the resulting impulse input
to ensure it is what you intended.



2. We know that
( )
( )
du t
t
dt
o = , where u(t) is the unit step input and o(t) is the impulse input. This
concept is implemented in the figure below. It appears that this approach may not work when starting at
t =0 (it does not generate o(t) but gives zero instead). If you start the Simulink simulation at t =1, it
should work fine. Again, be sure to scope the resulting impulse input to ensure it is what you intended.



Step dt
Step
Scope
10
s +s+10
2
G(s)
impulse input
du/dt
derivative Step @ t=1
Scope
10
s +s+10
2
G(s)
impulse input
34
3. Either of the previous two methods work fine. Here is a third method instead of using a discrete
step input as in Method 1 on the previous page, use a steep ramp for a very short time, followed by a
symmetric steep ramp with negative slope to send the input signal back to zero. Again the area under
this steep triangular input must be 1.

Let the final input value be a, the time to rise from 0 to a be called t
1
, and the final time when the
input signal reaches back to zero be called t
2
(by symmetry t
2
=2t
1
. This type of approximated Dirac
delta input is constructed in Simulink as follows. Add three ramp inputs, the first starting at t =0 with a
steep positive slope of c =a / t
1
, the second starting at t =t
1
with a negative slope of 2c, and the third
starting at t =t
2
with a positive slope of c (see the Simulink model shown below). For example, use a =
1000, t
1
=0.001 sec, c =1,000,000, and t
2
=0.002 sec. Again, be sure to scope the resulting ramped-
unramped Dirac delta approximation to ensure it is what you expected. The general equations for this
case are summarized below:

1
2 1
2
1
1
a ct
at
t
a
t
c
=
(
=
(

=
=







35
Other Inputs in Simulink

Simulink provides step, ramp, sine inputs among many other built-in possibilities. This
subsection discusses and presents some other inputs that can be built in Simulink.

Ramped-step input

The unit step input is very popular and common in the controls field. Actually it is a poor input
signal in the real world because no dynamic system can change its value instantaneously to match what
the unit step input is demanding. Instead, a ramped-step input may be better for real-world systems to
follow. The ramped-step input signal starts at zero (not instantaneously starting at a constant value) and
linearly changes, with constant slope, to a final constant value, which is held as long as the simulation
proceeds. Let the final input value be a, and the time to rise from 0 to a be called t
1
. This general
ramped-step input may be constructed in Simulink as follows. Add two ramp inputs, the first starting at
t =0 with a positive slope of c =a / t
1
, and the second starting at t =t
1
with a negative slope of c (or,
equivalently, subtract the second ramp with a positive slope as shown in the Simulink model below).
The example shown assumes a =3 and t
1
=2 sec. be sure to scope the resulting ramped-step to ensure it
is what you expected.





Scope
Ramp @ t1
Ramp
ramped-step input
36
Step and ramped-step inputs work well for controlling position variables (either translational or
rotational). They also work for controlling velocity when that is the output of interest. However, many
projects may need to move positions based on velocity control. In these cases consider using a
trapezoidal step input, which is similar to the ramped-step, but turns off rather than holding a constant
value indefinitely.

Trapezoidal-step input

The trapezoidal-step input signal starts at zero, linearly changes with constant slope to a final
constant value, which is held for a specified time. Then the input signal linearly decreases in a
symmetric manner back to zero, which is held as long as the simulation proceeds. Let the final input
value be a, the time to rise from 0 to a be called t
1
, the time to start the linear decrease back to 0 be
called t
2
, and the final time when the input signal reaches back to zero be called t
3
(by symmetry t
3
t
2
=
t
1
. This general trapezoidal-step input is constructed in Simulink as follows. Add four ramp inputs, the
first starting at t =0 with a positive slope of c =a / t
1
, the second starting at t =t
1
with a negative slope
of c, the third starting at t =t
2
with a negative slope of c, and finally the fourth starting at t =t
3
with a
positive slope of c (see the Simulink model shown below). The example shown assumes a =1, t
1
=2, t
2

=6, and t
3
=8 sec. Again, be sure to scope the resulting ramped-step to ensure it is what you expected.



37


Trapezoidal Velocity Input, Associated Position Command

The example trapezoidal-step velocity input is shown in magenta in the plot above. Integrating
this desired signal yields the associated position command. Since the controlled velocity returns to zero,
the associated position can be controlled to move from one displacement to another. This applies
equally to translational or rotational velocity/position.

Assuming the example trapezoid-step represents angular velocity e(t), the associated final
angular displacement u
F
is:

2 2
0 1 2 1 3 2
2
0 1 1
1 1
( ) ( )
2 2
2
F
F
ct a t t c t t
ct at
u u
u u
= + + +
= +


where in the example above, intial angle u
0
=0 and by symmetry t
1
=t
3
t
2
. Further we chose
2 1 1
2 t t t = (this can be changed by the user). Since the slope is c =a / t
1
, the above equation simplifies
to:

0
1
3
F
t
a
u u
=

Using the above equation, one can specify the initial and final angles (or translational positions), plus the
constant velocity term a, and solve for t
1
and construct any desired trapezoidal-step velocity input like
the example above.

38
4.2 Second-Order System Performance Specifications

This section presents plots for the four performance specifications presented in the 3012
NotesBook, based on the analytical formulas for the underdamped case.


Rise Time vs. for various e
n
values



Rise Time vs. e
n
for various values

39

Peak Time vs. e
d


Percent Overshoot vs.

40

Settling Time vs. e
n



41
Specifying Desired Poles for Critically-Damped or Overdamped Performance

In the ME 3012 NotesBook, to specify good behavior for the closed-loop controller, all we have
are underdamped performance specification equations. Many real-world controllers can benefit from
critically-damped or overdamped performance specifications. This original work is presented below.

For the critically-damped and overdamped cases, percent overshoot is zero and peak time is
infinite. Generally settling time is more important than rise time so this work will focus only on settling
time. We cannot use the underdamped equation for calculating 2% settling time for the critically-
damped and overdamped specifications. However, the definition for settling time is identical (the time
at which the critically-damped or overdamped response crosses the 98% line of the final value for a
unit step response. Using MATLAB step and right-clicking on the resulting plot can easily calculate the
settling time numerically this is the approach followed here.

For the critically-damped case, s
1
=s
2
(both poles are negative, real, and identical). Tere are
infinite overdamped cases; here we use s
2
=2s
1
(both poles are negative and real). All poles must be
negative for stability, but the plots below show positive s
1
for convenience of viewing the data
represents only negative poles.

For various pole values in the critically-damped case the settling time is found numerically using
MATLAB step and right-clicking in the plot (Characteristics Settling Time). The settling time t
S
vs.
pole s
1
plot is shown below. The same data was entered in Excel and the best exponential curve fits
were found to be:

Critically-Damped Overdamped

1
1
5.83
( )
S
t s
s
=
2
R 1 =
1
1
4.6
( )
S
t s
s
=
2
R 1 =

It was found that including s
1
values less than 1 made for worse curve fitting; therefore the curve
fits reported above are only for
1
1 10 s s s and the table below reports discrete settling time results for
1
1 s < , for completeness. Again the overdamped case uses s
2
=2s
1
. The two R
2
values indicate that
these are perfect curve fits.

s
1
t
S
(critically-damped) t
S
(overdamped)
0.25 23.30 18.40
0.50 11.70 9.20
0.75 7.78 6.14


The two plots below present settling time results for the critically-damped and overdamped
cases, respectively. To use these results for specifying good behavior in controller design, one can
specify the desired settling time, choose critically-damped or overdamped, and solve for s
1
from the
appropriate best curve fit equation above (or try to read the s
1
value from the appropriate plot). Once s
1

is known, use s
2
=s
1
for the critically-damped case and s
2
=2s
1
for the overdamped case. If you desire a
different type of overdamping, you can use trial-and-error.

42
For all design cases, be sure to evaluate the expected dynamic response over time for your
desired behavior to ensure it agrees with what you specified (in terms of settling time and 0%
overshoot).



Settling Time vs. s
1


Critically-Damped s
2
= s
1
and Overdamped s
2
= 2s
1


1 2 3 4 5 6 7 8 9 10
0
1
2
3
4
5
6
s
1
t
S

(
s
e
c
)


critically-damped
overdamped
43
4.3 Open-Loop and Closed-Loop System Example

Given the following open-loop system model ( ) 2 ( ) 4 ( ) 4 ( ) y t y t y t u t + + =

subject to (0) 0, (0) 0 y y = = and a unit step input.

Open-Loop Behavior

Open-loop transfer function and block diagram:

2
2 2 2
4
( )
2 2 4
n
n n
G s
s s s s
e
e e
= =
+ + + +


Open-loop characteristic polynomial A
OL
(s), natural frequency e
n
, dimensionless damping ratio ,
damped frequency e
d
, and poles s
1,2
(complex conjugate poles with negative real part, therefore this
system is underdamped):

2
( ) 2 4
OL
s s s A = + + 2
n
e = 0.5 = 3
d
e =

1,2
1 3 s i =

Open-Loop System Unit Step Response

Open-loop performance specifications
t
R
~ 0.84 s
t
P
= 1.81 s
PO = 16.30%
t
S
~ 4.00 s

Open-loop y
SS
use the final value theorem (FVT)
2 2
0 0 0 0
4 1 4 4
lim ( ) lim ( ) lim ( ) ( ) lim lim 1
2 4 2 4 4
OL
SS
t s s s s
y y t sY s sG s U s s
s s s s s

| || |
= = = = = = =
| |
+ + + +
\ .\ .

0 1 2 3 4 5 6
0
0.2
0.4
0.6
0.8
1
1.2
y
o
(
t
)
t (sec)
44
Closed-Loop Controller Evaluation
Choose a simple controller ( ) 10
C
G s K = =

Assume a perfect sensor, i.e. H(s) =1.
Control law ( ) ( ) ( ) ( )
C
U s G s E s KE s = =

Closed-loop block diagram and transfer function:

( )
2 2
4 40
( )
2 4 4 2 44
K
T s
s s K s s
= =
+ + + + +


Closed-loop characteristic polynomial A
CL
(s), natural frequency e
n
, dimensionless damping ratio ,
damped frequency e
d
, and poles s
1,2
(complex conjugate poles with negative real part, therefore this
closed-loop system is also underdamped):

2
( ) 2 44
CL
s s s A = + + 6.63
n
e = 0.15 = 6.56
d
e =

1,2
1 6.56 s i =

Open- and Closed-Loop System Unit Step Responses

Closed-loop performance specs Open-loop performance specs
t
R
~ 0.14 s (in error) t
R
~ 0.84 s
t
P
= 0.48 s t
P
= 1.81 s
PO = 62.1% PO = 16.3%
t
S
~ 4.02 s t
S
~ 4.00 s

The MATLAB m-file to generate this plot is given later in this section.

Closed-loop y
SS
use the final value theorem (FVT)
2 2
0 0 0 0
40 1 40 40
lim ( ) lim ( ) lim ( ) ( ) lim lim 0.909
2 44 2 44 44
CL
SS
t s s s s
y y t sY s sT s R s s
s s s s s

| || |
= = = = = = =
| |
+ + + +
\ .\ .

0 1 2 3 4 5 6
0
0.5
1
1.5
t (sec)
y
(
t
)


Open-loop
Closed-loop
45
Steady-state error
Let us assume that the steady-state value y
SS
of the open-loop system is the desired output value.
We calculate the steady-state error of the closed-loop system relative to the desired open-loop value.
100%
OL CL
OL
SS SS
SS
SS
y y
e
y

=

For the example
40
1
44
100% 9.1%
1
SS
e

= =

Closed-loop steady-state error Open-loop steady-state error
e
SS
=9.1% e
SS
=0%


Summary
Choosing a random simple controller made the step response worse than the original open-loop
case! Controller design must be done properly or things can easily get worse.
For ( ) 10
C
G s K = = , the closed-loop system is more underdamped than the open-loop
system: the rise and peak times are much faster (not necessarily good for the dynamics of the system),
the percent overshoot is much worse, the settling time turned out to be about the same, and a steady-
state error was introduced. The steady-state error arose because the controller introduced a virtual
spring, in addition to the existing spring in the open-loop system, making the closed-loop system stiffer,
resulting with a smaller displacement given the same unit step input force.

Simulink Simulation
The MATLAB Simulink diagram below recreates the previous plot comparing the open- and
closed-loop systems for the current example.

Two new blocks are used, the circular summing junction and the triangular gain (representing the
simple proportional controller). More complex controllers can be represented by transfer functions as
we will see later. The feedback loop takes the closed-loop system output back to the summing junction.
The mux block (two signals into one above) allows us to compare both results on one scope (Plots).
Both open- and closed-loop simulations use the same Step input for a fair comparison (pickoff point).
If we choose a final simulation time of 6 sec (entered via the time box on the simulation window
menu), the Simulink plots are identical to that shown earlier.

46
Here is the MATLAB program to create the figure for the example of this section, comparing the
open- and closed-loop system responses to a unit step input.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Open- l oop/ Cl osed- l oop Exampl e
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl ear ; cl c;
% Open- l oop uni t st ep r esponse
numo = [ 4] ; deno = [ 1 2 4] ;
SysO = t f ( numo, deno) ;
zer oso = r oot s( numo) ; pol eso = r oot s( deno) ;
[ wno, zet ao] = damp( deno) ;
t = [ 0: 0. 01: 6] ;
yo = st ep( SysO, t ) ; %Open- l oop uni t st ep r esponse

% Cl osed- l oop
K = 10; %Si mpl e pr opor t i onal cont r ol l er
numc = [ 4*K] ; denc = [ 1 2 4+4*K] ;
SysC = t f ( numc, denc) ;
zer osc = r oot s( numc) ; pol esc = r oot s( denc) ;
[ wnc, zet ac] = damp( denc) ;
yc = st ep( SysC, t ) ; %Cl osed- l oop uni t st ep r esponse

% Check hand- der i vat i on of T( s) =[ numc/ denc] vi a MATLAB
numgc = [ K] ;
dengc = [ 1] ;
[ numa, dena] = ser i es( numgc, dengc, numo, deno) ;
[ numc2, denc2] = f eedback( numa, dena, [ 1] , [ 1] ) ;
TCheck = t f ( numc2, denc2) %Di spl ay T( s) check r esul t s

% Pl ot open- and cl osed- l oop st ep r esponses
f i gur e;
pl ot ( t , yo, ' r ' , t , yc, ' g' ) ;
set ( gca, ' Font Si ze' , 18) ; l egend( ' Open- l oop' , ' Cl osed- l oop' ) ;
axi s( [ 0 6 0 1. 5] ) ;
gr i d; yl abel ( ' \ i t y( t ) ' ) ; xl abel ( ' \ i t t ( \ i t sec) ' ) ;

% Per f or mance specs: open- l oop
wdo = wno( 1) *sqr t ( 1- zet ao( 1) ^2) ; %Damped nat ur al f r equency
t r o = ( 2. 16*zet ao( 1) + 0. 60) / wno( 1) %Ri se t i me
t po = pi / wdo %Peak t i me
poo = 100*exp( - zet ao( 1) *pi / sqr t ( 1- zet ao( 1) ^2) ) %Per cent over shoot
t so = 4/ ( zet ao( 1) *wno( 1) ) %Set t l i ng t i me

% Per f or mance specs: cl osed- l oop
wdc = wnc( 1) *sqr t ( 1- zet ac( 1) ^2) ; %Damped nat ur al f r equency
t r c = ( 2. 16*zet ac( 1) + 0. 60) / wnc( 1) %Per cent over shoot
t pc = pi / wdc( 1) %Peak t i me
poc = 100*exp( - zet ac( 1) *pi / sqr t ( 1- zet ac( 1) ^2) ) %Per cent over shoot
t sc = 4/ ( zet ac( 1) *wnc( 1) ) %Set t l i ng t i me

% Ri ght - cl i ck f or per f or mance specs: open- and cl osed- l oop
f i gur e; st ep( SysO) ; gr i d;
f i gur e; st ep( SysC) ; gr i d;


47
4.4 First- and Second-Order Transient Response Characteristics

The Cartesian representation of the 3x4 subplots (step responses) from the ME 3012 NotesBook
Section 4.4 is for convenience only, since that is the way the MATLAB subplot works. For more
accuracy, the underdamped cases c. should be represented using polar coordinates (for this example
shown to scale below) rather than Cartesian coordinates.



Recall for underdamped poles the polar representation is r =e
n
and
1
sin u

= ; thus the two symmetric


angles in the examples above are 5.7 u =


and 30 u =

.

Also, remember all complex conjugates occur in pairs, as shown above (two poles generate one
time response plot in all second-order cases, including the non-complex-conjugate cases).

c
1
=0.5
e = 1
n
=0.1
e = 2
n
Im
Re
x
x
x
x
x
x
x
x
c
1
c
2
c
2
c
3
c
3
c
4
c
4
e = 2
n
e = 1
n
=0.5
=0.1
48
We can also perform the example of Section 4.4 using the impulse function in place of the
step function; this is shown below.

Transient Response Characteristics vs. Re-Im-plane pole locations
(impulse responses, generic second-order system, zero initial conditions)
Figure key
5 . 0 = e
n
= 2
s i
12
1 173
,
. =
c
1
. underdamped
= 01 . e
n
= 2
s i
12
02 199
,
. . =
c
2
. underdamped
= 0 e
n
= 2
s i
12
2
,
=
d
1
. undamped
= 01 . e
n
= 2
s i
12
02 199
,
. . =
e
1
.
= 05 . e
n
= 1
s i
12
05 0866
,
. . =
c
3
. underdamped
= 01 . e
n
= 1
s i
12
01 0995
,
. . =
c
4
. underdamped
= 0 e
n
= 1
s i
12 ,
=
d
2
. undamped
= 01 . e
n
= 1
s i
12
01 0995
,
. . =
e
2
.
= 2 e
n
= 1
s
12
373 027
,
. , . =
a. overdamped
=1 e
n
= 1
s
12
1
,
=
b. critically-
damped
= 0 e
n
= 0
s
12
0
,
=
d
3
. special
undamped
= 1(-1.005)
e
n
= 1( 0.99
n
e = )
s
12
1
,
= (0.9,1.1)
f. (g.)



Note While cases f and g may look identical between the step (ME 3012 NotesBook) and impulse (this
page) responses, they are different the impulse responses go to infinity faster than the step cases.

0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-100
-50
0
50
100
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-10
-5
0
5
10
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
0 5 10 15 20
0
5
10
15
20
0 5 10 15 20
0
2
4
6
8
10
12
14
16
x 10
9


f
g
49
Here is the MATLAB program to create the figure for the example of Section 4.4, comparing the
various second-order system transient responses to a unit step input, based on pole locations. To find
the impulse responses of the previous page, simply substitute MATLAB function impulse for step.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Gener at e pl ot s t o di spl ay t r ansi ent uni t st ep r esponse char act er i st i cs
% gi ven di f f er ent di mensi onl ess dampi ng r at i os and nat ur al f r equenci es
% f or t he gener i c second- or der syst em Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c; cl ear ; f i gur e;

dt = 0. 01; t f = 20; t = [ 0: dt : t f ] ;
Xmi n = 0; Xmax = t f ; Ymi n = 0; Ymax = 2;

subpl ot ( 3, 4, 1) ;
zet a = 0. 5; wn = 2; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 1 = r oot s( den) ;

subpl ot ( 3, 4, 2) ;
zet a = 0. 1; wn = 2; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 2 = r oot s( den) ;

subpl ot ( 3, 4, 3) ;
zet a = 0; wn = 2; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 3 = r oot s( den) ;

subpl ot ( 3, 4, 4) ;
zet a = - 0. 1; wn = 2; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax - 50 50] ) ; r 4 = r oot s( den) ;

subpl ot ( 3, 4, 5) ;
zet a = 0. 5; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 5 = r oot s( den) ;

subpl ot ( 3, 4, 6) ;
zet a = 0. 1; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 6 = r oot s( den) ;

subpl ot ( 3, 4, 7) ;
zet a = 0; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 7 = r oot s( den) ;

subpl ot ( 3, 4, 8) ;
zet a = - 0. 1; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax - 10 10] ) ; r 8 = r oot s( den) ;

subpl ot ( 3, 4, 9) ;
zet a = 2; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 9 = r oot s( den) ;

subpl ot ( 3, 4, 10) ;
zet a = 1; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax Ymi n Ymax] ) ; r 10 = r oot s( den) ;

subpl ot ( 3, 4, 11) ;
zet a = 0; wn = 0; num= [ 1] ; den = [ 1 0 0] ; y = st ep( num, den, t ) ;
pl ot ( t , y) ; axi s( [ Xmi n Xmax 0 200] ) ; r 11 = r oot s( den) ;

subpl ot ( 3, 4, 12) ;
zet a = - 1; wn = 1; num= [ wn^2] ; den = [ 1 2*zet a*wn wn^2] ; yf = st ep( num, den, t ) ;
zet a = - 1. 005; wn = sqr t ( 0. 99) ; num= [ wn^2] ;
den = [ 1 2*zet a*wn wn^2] ; yg = st ep( num, den, t ) ;
pl ot ( t , yf , ' b' , t , yg, ' g' ) ; l egend( ' f ' , ' g' ) ; axi s( [ Xmi n Xmax 0 16e09] ) ;

50
For the impulse response transient characteristics plots presented two pages back, no initial
conditions were specified in the MATLAB program, which means that MATLAB assumes zero initial
conditions. We can see zero initial condition on position are achieved in all of the plots. However, none
of these impulse response plots has a zero slope at t =0, which means that the imulse response cannot
allow zero velocity initial condition. Why? Let us address this issue via an example.


Example analytical impulse response solution for the generic second-order system

Solve
2 2
( ) 2 ( ) ( ) ( )
n n n
y t y t y t t e e e o + + = for y(t) given , e
n
, and zero initial conditions:

0
0
(0) 0
(0) 0
y y
y v
= =
= =


Here the Laplace Transform method will be used. The first step is to take the Laplace Transform
of both sides of the ODE, including the zero initial conditions, and solving algebraically for the
unknown in the Laplace domain, ( ) { ( )} Y s y t = .

{ }
2 2
2 2 2
2 2 2
2
2 2
( ) 2 ( ) ( ) ( )
( ( ) (0) (0)) 2 ( ( ) (0)) ( ) (1)
( 2 ) ( )
( )
2
n n n
n n n
n n n
n
n n
y t y t y t t
s Y s sy y sY s y Y s
s s Y s
Y s
s s
e e e o
e e e
e e e
e
e e
+ + =
+ + =
+ + =
=
+ +



Note that the system characteristic polynomial
2 2
2
n n
s s e e + + appears when using the Laplace
Transform method.

For simplicity in solution, let us assume this system is overdamped, i.e. there are two negative,
real, distinct poles (our impulse response conclusion will apply to all damping cases).

2 2
2 2
1 2
( )
2 ( )( )
n n
n n
Y s
s s s s s s
e e
e e
= =
+ + + +



The Heaviside Partial Fraction expansion of Y(s) is:
2
1 2
1 2 1 2
( )
( )( ) ( ) ( )
n
C C
Y s
s s s s s s s s
e
= = +
+ + + +


Solving for the residues C
1
and C
2
:

2 2
1 2 1 2 2 1
1 2 1 2 1 2 1 2
0 ( ) ( )
( ) ( ) ( )( ) ( )( ) ( )( )
n n
s C C C s s C s s
s s s s s s s s s s s s s s s s
e e + + + +
+ = = =
+ + + + + + + +


51
1
1 2
0 2
1 2 2 1
0
n
s C C
s C s C s e
+ =
+ =

2
1
2 1
2
2
1 2
n
n
C
s s
C
s s
e
e
=



This solution is always valid since due to the overdamped assumption,
1 2
s s = .

To find the solution y(t) in the time domain, we must take the inverse Laplace Transform of Y(s).

{ }
1 2
1
2
1
1 2
1 1 2
1 2
1 2
( ) ( )
( )
( )( )
( )
( ) ( )
( )
n
s t s t
y t Y s
y t
s s s s
C C
y t
s s s s
y t C e C e
e


=

=
`
+ +
)

= +
`
+ +
)
= +




Checking the zero initial conditions from this solution, it is seen that the initial position is zero,
but the the initial velocity is NOT zero:

1 2
(0) (0)
1 2 1 2
2 2 2 2
2 1 1 2 2 1 2 1
(0) (1) (1)
0
s s
n n n n
y Ce C e C C
s s s s s s s s
e e e e

= + = +
= + =

=



1 2
1 2
1 1 2 2
(0) (0)
1 1 2 2 1 1 2 2
2 2 2 2
1 2 1 2
2 1 1 2 2 1 2 1
2
2 1
2 1
2
( )
(0) (1) (1)
( )
0
s t s t
s s
n n n n
n
n
y t s Ce s C e
y s Ce s C e s C s C
s s s s
s s s s s s s s
s s
s s
e e e e
e
e


=
= =
= = +

= =



The impulse responses for all other damping cases similarly result in non-zero initial velocities
(slopes of y(t) at t =0).

52
4.5 System Type

For a system transfer function expressed in the following zero-pole form (m zeros z
j
and n non-
zero poles p
i
):
1 2
1 2
( )( ) ( )
( )
( )( ) ( )
m
r
n
K s z s z s z
G s
s s p s p s p
+ + +
=
+ + +



r is the System Type, i.e. r is the number of poles at s =0. The System Type is the number of system
integrators. This section presents transient response characteristics for sample Type 0, I, and II systems.

Unit Step Responses (output vs. time, 0 ICs) for different System Types
Type 0 Type I Type II


1
( ) G s
s
=
2
1
( ) G s
s
=
1
( )
( 1)
G s
s
=
+

1
( )
( 1)
G s
s s
=
+

2
1
( )
( 1)
G s
s s
=
+

2
10
( )
( 10)
G s
s s
=
+ +

2
10
( )
( 10)
G s
s s s
=
+ +

2 2
10
( )
( 10)
G s
s s s
=
+ +




Type I, II, and higher systems have no effective spring, so their transient responses go to infinity. The
steady state results are constant, linear, and parabolic for Types 0, I, II, respectively. What is the
damping condition of each example? The stability condition? The middle center example is typical of
an electric motor model with input torque t(t) and output angle u(t). Distributed block diagram:

53
4.7 Term Example Open-Loop Transient Response

Here is the MATLAB program to create the figure for the example of Section 4.7, presenting the
Term Example open-loop transient responses for load shaft angle and load shaft angular velocity outputs
given unit impulse, unit step, and unit ramp inputs.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Ter mexampl e - el ect r omechani cal syst emt r ansi ent r esponses
% Thet a and Omega out put s f or i mpul se, st ep, and r amp i nput s
% Dr . Bob ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

cl c; cl ear ;

numt = [ 5] ; dent = [ 1 11 1010 0] ; % open- l oop t r ansf er f unct i on V t o Thet aL
Syst = t f ( numt , dent ) ;
pol et = r oot s( dent ) ;
numw = [ 5] ; denw = [ 1 11 1010] ; % open- l oop t r ansf er f unct i on V t o OmegaL
Sysw = t f ( numw, denw) ;
pol ew = r oot s( denw) ;

t 0 = 0; dt = 0. 005; t f = 0. 8; % evenl y- spaced t i me ar r ay
t = [ t 0: dt : t f ] ;

f i gur e;

subpl ot ( 321) ;
[ y, x] = i mpul se( Syst , t ) ; % i mpul se
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 0 0. 008] ) ;

subpl ot ( 322) ;
[ y, x] = i mpul se( Sysw, t ) ;
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 - 0. 1 0. 15] ) ;

subpl ot ( 323) ; % st ep
[ y, x] = st ep( Syst , t ) ;
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 0 0. 004] ) ;

subpl ot ( 324) ;
[ y, x] = st ep( Sysw, t ) ;
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 0 0. 008] ) ;

subpl ot ( 325) ;
[ y, x] = l si m( Syst , t , t ) ; %uni t r amp i nput u( t ) = t
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 0 0. 0016] ) ;

subpl ot ( 326) ;
[ y, x] = l si m( Sysw, t , t ) ;
pl ot ( t , y) ; gr i d; axi s( [ 0 0. 8 0 0. 004] ) ;

54
Term Example Transient Response, Extended

We can extend the Term Example transient responses example from ME 3012 NotesBook
Section 4.7 for one more input (the unit parabola,
2
( ) 2 p t t = ) and one more output (o
L
(t), the angular
acceleration of the load shaft).

Figure key
u
L
(t) impulse e
L
(t) impulse o
L
(t) impulse
u
L
(t) unit step e
L
(t) unit step o
L
(t) unit step
u
L
(t) unit ramp e
L
(t) unit ramp o
L
(t) unit ramp
u
L
(t) unit parabola e
L
(t) unit parabola o
L
(t) unit parabola




0 0.2 0.4 0.6 0.8
0
2
4
6
8
x 10
-3
0 0.2 0.4 0.6 0.8
-0.1
0
0.1
0 0.2 0.4 0.6 0.8
-5
0
5
0 0.2 0.4 0.6 0.8
0
2
4
x 10
-3
0 0.2 0.4 0.6 0.8
0
2
4
6
8
x 10
-3
0 0.2 0.4 0.6 0.8
-0.1
0
0.1
0 0.2 0.4 0.6 0.8
0
0.5
1
1.5
x 10
-3
0 0.2 0.4 0.6 0.8
0
2
4
x 10
-3
0 0.2 0.4 0.6 0.8
0
2
4
6
8
x 10
-3
0 0.2 0.4 0.6 0.8
0
2
4
x 10
-4
0 0.2 0.4 0.6 0.8
0
0.5
1
1.5
x 10
-3
0 0.2 0.4 0.6 0.8
0
2
4
x 10
-3
55
Electrical vs. Mechanical Rise Time
Usually the electrical system time constant L/R is small relative to the mechanical system time
constant J
E
/c
E
. This means that when voltage v
A
(t) is applied to the armature circuit, the armature
current i
A
(t) rises much faster than the motor shaft angular velocity e
M
(t) does (see the figure below)
when i
A
(t) is applied to generate motor torque t
M
(t) . Here are the component first-order transfer
functions and time constants for the armature circuit and rotational mechanical system dynamics.
1
( ) 1
( )
( ) ( )
A
A B
I s
G s
V s V s Ls R
= =
+

0.1
L
R
=
3
( ) 1
( )
( )
M
M E E
s
G s
s J s c
O
= =
T +

1
E
E
J
c
~

armature current motor shaft angular velocity

Therefore, the electromechanical system open-loop block diagram transfer function could be
simplified as follows. For V
A
(s) input, O
L
(s) output, the open-loop transfer function is:
( )( )
( )
( )
1
T
T
T B T B
K
K
R
G s
Ls R Js C K K sn K K L
s Js C sn
R R
u
= =
+ + + ( ( | |

+ + +
|
(
\ .

Set 0
L
R
relative to
E
E
J J
c c
= since the mechanical system dominates.
( )
( )
T
T B
K
R
G s
K K
Js C sn
R
u
=
(
+ +
(



The simplified V
A
(s) input, O
L
(s) output transfer function is second-order and the simplified V
A
(s) input,
O
L
(s) output transfer function is first-order.
( )
( )
T
T B
K
n
G s
JRs RC K K s
u
=
+ + (


( )
( )
T
T B
K
n
G s
JRs RC K K
e
=
+ +


0 1 2 3 4 5
0
0.2
0.4
0.6
0.8
1
t (sec)
O
u
t
p
u
t
56
5. Controller Design

5.1 Controller Design Introduction

Controller Types

1. Proportional ( )
C
G s K = Root locus method
This is the simplest controller, but it only has one-dof (one gain).

2. Lead controller
( )
( )
( )
C
s a
G s K
s b
+
=
+
a <b (by an order of magnitude)
Name from frequency response
Speeds up transient response and increases relative stability.
Increase natural frequency e
n
for faster response without affecting desired damping ratio .
Rules of thumb
- Place the negative, real zero a near the middle G(s) pole
- Place the negative, real pole b as far negative as possible, at least b =10a

3. Lag controller
( )
( )
( )
C
s c
G s K
s d
+
=
+
c >d (by an order of magnitude)
Name from frequency response
Improves steady-state error but slows transient response.
Rules of thumb
- Place the negative, real pole d near the Re-Im origin
- Place the negative, real zero c at about c =10d

4. Lead/Lag controller
( )( )
( )
( )( )
C
s a s c
G s K
s b s d
+ +
=
+ +

This controller improves the steady-state error without reducing the desired e
n
much. Also does
not affect the desired .

5. PID controller ( )
I
C P D
K
G s K K s
s
= + +

Proportional, Integral, Derivative of error E(s)

PID controllers are common industrial controllers since they are simple, effective, and robust to
disturbances. PID characteristics:
- P reasonably good error tracking, slow rise, with steady-state error
- PD adds damping, better stability, steady-state error unchanged
- PI reduce steady-state error, slower rise time
- PID compromise, best considering all competing factors

According to some controls references, the D term is not implementable because we cannot build
physical systems with more zeros than poles (MATLAB tfchk generates an error when you enter the
57
PID transfer function over its common denominator). Also, when the system is subjected to a unit step
input from rest, the D term differentiates the step and creates an impulse. However, Simulink and
industrial controllers implement full PID controllers successfully.


Control Law (for all controller types)
The control law calculates what the actuator input to the plant should be in the s domain, based
on the measured error (the difference between the desired and actual outputs) and the desired
performance goals.
| | ( ) ( ) ( ) ( ) ( ) ( ) ( )
C C
U s G s E s G s R s H s Y s = =

Again, our controller design is in the s domain. Digital controller implementation, an important
real-world issue so that a computer can perform the control given the controller design from the s
domain, is beyond the scope of ME 3012. The above control law must be implemented at every control
time step, so the actuator input u(t) is constantly calculated by the controller to achieve the goals.

When the number of controller unknowns equals the order of the closed-loop system we will use
parameter matching to design the controller (solve the unknown controller gains). If this condition is
not met, we can use rules of thumb, trial and error, and the root-locus method to design the controller.


MATLAB Functions for Controller Design
conv multiply polynomial factors
damp calculate the poles, e
n
, and for each system mode
feedback combine transfer functions in a feedback loop
rlocus draw the root-locus plot for the system with a proportional controller
rlocfind determine controller gain K values from a root-locus plot
rltool trial-and-error controller design via the root-locus plot
roots calculate the roots of a polynomial
series combine transfer functions in series
sgrid draw e
n
, polar grid on the Re-Im pole plane
tf2zp convert transfer function to zero-pole system description
zp2tf convert zero-pole to transfer function system description


58
Second-order performance specifications revisited inequalities

For controller design, how should we choose good behavior? One must specify good poles as an
input to the controller design process. Thus far we have specified an exact desired percent overshoot
(yielding an exact ) and an exact settling time (yielding an exact e
n
knowing from PO), from which
the desired behavior characteristic polynomial is
2 2
2
n n
s s e e + + , from which the desired closed-loop
poles can be found.

A much more general and powerful method for specifying good controller behavior (desired
closed-loop poles) is to specify inequalities for performance specifications rather than exact values. In
this example we require 2
P
t s sec, 5% PO s , and 4
S
t s , and the problem is to determine and show on
the Re-Im plane acceptable regions for the closed-loop controller poles given these three simultaneous
inequality constraints.

a. From
2
2
1
P
d
n
t
t t
e
e
= = s



we have 2
d
e t > rad/sec (by symmetry, also 2
d
e t s rad/sec).


b. From
2
1
100 5% PO e
t

| |

|
|

\ .
= s
we have 0.69 > , or 43.6 u >

(symmetric)


c. From
4
4
S
n
t
e
~ s
we have 1
n
e > , that is 1
n
e s


Let us plot all three constraints on the Re-Im plane; we get three straight-line constraints, two of
them symmetric about the Re axis. Then we shade the acceptable side of each constraint line.
59
Plot inequality constraints on Re-Im pole plane



Acceptable range (cross-hatched) for three performance specification inequalities

To satisfy the inequality requirements on the performance specifications, one may choose two
symmetric underdamped complex-conjugate poles anywhere in the shaded regions. The peak time and
percent overshoot specifications dominate and the settling time constraint is not active.

=0.69
e = t/2
d
Im
Re
e = 1
n
e = t/2
d
=0.69
60
ITAE Performance Index Alternate method for choosing good desired closed-loop poles.
control swiftness of response change rise and peak time
control error of response change % overshoot, settling time

These are competing requirements. How should we choose the desired poles for the closed-loop
system controller design? Try performance indices many cases have been solved to tell you the
optimal poles given various performance measures (indices). Here we will only consider one, the
integral of time multiplied by the absolute error (ITAE).
0
( ) ITAE t e t dt

=
}


Minimize ITAE to simultaneously optimize competing requirements. Minimum ITAE means less
time and smaller error in balance. For first- through sixth-order systems, the following characteristic
polynomials minimize ITAE. If we design the feedback controller to meet one of these specifications,
the shaping of the dynamic transient response will be optimized according to ITAE. The engineer must
set the value for e
n
to suit the time nature of the desired closed-loop system. Note for all cases (except
the first order system) some overshoot is required to optimize ITAE. We simulate with MATLAB to see
this (using e
n
=3 rad/s for all plots below).

Order Optimal Characteristic Polynomials
1
n
s e +
2
2 2
1.4
n n
s s e e + +

3
3 2 2 3
1.75 2.15
n n n
s s s e e e + + +

4
4 3 2 2 3 4
2.1 3.4 2.7
n n n n
s s s s e e e e + + + +

5
5 4 2 3 3 2 4 5
2.8 5.0 5.5 3.4
n n n n n
s s s s s e e e e e + + + + +

6
6 5 2 4 3 3 4 2 5 6
3.25 6.6 8.6 7.45 3.95
n n n n n n
s s s s s s e e e e e e + + + + + +



ITAE Desired Unit Step Responses

0 1 2 3 4
0
0.2
0.4
0.6
0.8
1
1.2
1.4
t (sec)
y
(
t
)
1st
2nd
3rd
4th
5th
6th
61
5.2 Root-Locus Method

Examples 2 Re-create these examples in MATLAB. For each, be sure to interpret what is happening
in the root locus plot.

2a.
2
( )
( 4)
s
G s
s s
+
=
+



2b.
2 3 2
1 1
( )
( 2)( 4) ( 10 32 32)
s s
G s
s s s s s s s
+ +
= =
+ + + + +



2c.
2
1 1
( )
( 2)( 3) ( 5 6)
s s
G s
s s s s s s
+ +
= =
+ + + +



2d.
3 2
1
( )
( 12 64 128)
G s
s s s s
=
+ + +



2e.
2
2
14 96
( )
( 14)
s s
G s
s s
+ +
=
+



2f.
2 2
2 2
( 4 10004)( 12 90036)
( )
( 10)( 2 2501)( 6 22509)
s s s s
G s
s s s s s
+ + + +
=
+ + + + +



62
Example 3 Conditionally stable example (continued)

The unit step responses for Root-Locus Example 3 from the ME 3012 NotesBook are shown
below, as K increases. Clearly we need a method for determining K to yield a desirable closed-loop
system.



Conditionally-stable example, unit step responses as K increases from 0.

K values legend
0 0.01 0.07
0.40 1.03 1.96
2.73 3.20 6420

Unstable for 0.001 0.160 K s s (using rlocfind(Sys))

0 1 2 3 4 5
-1
-0.5
0
0.5
1
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
-5
0
5
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
-20
-15
-10
-5
0
5
10
15
20
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5
0
0.5
1
1.5
2
Step Response
Time (sec)
A
m
p
lit
u
d
e
63
Relate and e
n
to the Re-Im poles plane
Recall the underdamped generic second-order system poles are:
2
1,2
1
n n n d
s i i e e e e = = (0 1 < < )

Further recall the graphical representation of these underdamped s
1,2
pole locations (derived earlier in
the ME 3012 NotesBook, this is symmetric as shown below). We measure u with the right hand from
the positive vertical (by symmetry, measure u with the left hand from the negative vertical).

The radial distance is e
n
and
1
sin u

= . We can use MATLAB to create e


n
, grids on the root-locus
plot. This sgrid result is shown above and is symmetric about the Re axis.

dmp = [0:0.1:1]; om = [1:1:5]; sgrid(dmp,om);

Also, we can add vertical lines to the left of zero for lines of constant settling time (i.e. constant
e
n
) and symmetric horizontal lines for lines of constant peak time (i.e. constant
2
1
d n
e e = ).

Put your root-locus plot on the same figure.
hold on;
rlocus(Sys);
[K,poles] = rlocfind(Sys)

Be sure the root-locus figure is active (if there are other MATLAB graphics figures on the
screen). The MATLAB window gives you a cross-hair cursor with which to select a point on the root-
locus plot. Choose a point where the root-locus plot intersects a desirable e
n
, or other desirable pole
specification. MATLAB responds with the K value and associated poles.

For controller design, check out rltool, very powerful and cool! rltool has built-in grid
tools for two of the generic second-order system performance specifications (settling time and percent
overshoot), plus and e
n
: right-click design requirements new.


-5 0 5
-5
0
5
Re
I
m
64
5.8 Controller Design Example 2 unstable G(s)

This example uses a similar open-loop transfer function as in Controller Design Example 1, but it
is an unstable open-loop plant transfer function (negative damping term).
2
10
( )
10
G s
s s
=
+


Step 1. Analyze the open-loop system behavior.
There is only one small change in the open-loop transfer function compared to Controller Design
Example 1: there is a negative sign on the open-loop s term. The negative damping injects energy into
the system instead of dissipating energy.

open-loop poles
1,2
0.5 3.12 s i = +
The real parts of the poles are positive so this system is UNSTABLE!

t
R
=0.08 s t
P
=1.01 s PO =165.4% t
S
=8 s

These transient characteristics are all BOGUS since they are calculated based on the underdamped,
positive damping, performance specification equations. The open-loop unit step response is:



When we use MATLAB function step for this problem and right-click for the performance
specifications, no useful results are generated.


Step 2. Specify the desired behavior for the closed-loop system.
2 3 2
( ) ( 26.7)( 5.33 14.93) 32 157.2 398.2
DES
CL
s s s s s s s A = + + + = + + +

Step 3. Specify the form for the controller transfer function.
PID Controller ( )
I
C P D
K
G s K K s
s
= + +

0 1 2 3 4 5 6 7 8 9 10
-150
-100
-50
0
50
100
y
(
t
)
t (sec)
65
Step 4. State the controller design problem to be solved.

Given
2
10
( )
10
G s
s s
=
+
, H(s) =1,
3 2
( ) 32 157.2 398.2
DES
CL
s s s s A = + + + , ( )
I
C P D
K
G s K K s
s
= + +

Solve for the PID controller gains K
P
, K
I
, and K
D
. Then evaluate the PID controller performance.


Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop system.
Derive the closed-loop transfer function as a function of the PID controller gains.

2 2
2 2
2 2 2
2 2
2
2 2
10( ) 10( )
( ) ( ) ( 10) ( 10)
( )
10( ) ( 10) 10( ) 1 ( ) ( ) ( )
1
( 10) ( 10)
10( )
( )
( 10) 10( )
10(
( )
D P I D P I
C
D P I D P I C
D P I
D P I
D
K s K s K K s K s K
G s G s s s s s s s
T s
K s K s K s s s K s K s K G s G s H s
s s s s s s
K s K s K
T s
s s s K s K s K
K
T s
+ + + +
+ +
= = =
+ + + + + + +
+
+ +
+ +
=
+ + + +
=
2
3 2
)
( 1 10 ) (10 10 ) (10 )
P I
D P I
s K s K
s K s K s K
+ +
+ + + + +



Match the symbolic form (function of K
P
, K
I
, K
D
) with the numerical desired characteristic
polynomial use the same third-order desired characteristic polynomial from Controller Design
Example 1, which is an augmented version of the second-order behavior with 5% overshoot and 1.5 sec
settling time.


Denominator parameter matching (fully-decoupled solution)

3
2
1
0
1 1
1 10 32
10 10 157.2
10 398.2
D
P
I
s
s K
s K
s K
=
+ =
+ =
=

3.3
14.72
39.82
D
P
I
K
K
K
=
=
=



There is only one small change, compared to the stable underdamped system PID controller from
Controller Design Example 1. Only K
D
changed slightly (it was 3.1 before; now it is 3.3 for the unstable
system), but K
P
and K
I
are identical.


66
Step 6. Evaluate the PID controller performance in simulation.

Open- vs. Closed-Loop unit step responses

Open-Loop Closed-Loop PID
t
R
= N/A sec t
R
= 0.05 sec
t
P
= sec t
P
= 0.16 sec
PO = NaN PO = 10.7%
t
S
= sec t
S
= 1.03 sec
e
SS
= e
SS
= 0%


Step 7. Include an output attenuation correction factor if necessary.

Again, no output attenuation correction factor is required thanks to the K
I
term the effective
closed-loop stiffness is the same as the open-loop stiffness. The K
I
term ensures zero steady-state error.

Closed-loop transfer function:
2
3 2
33 147.2 398.2
( )
32 157.2 398.2
s s
T s
s s s
+ +
=
+ + +



We stabilized the unstable system but did not achieve the desired transient characteristics. The
above PID closed-loop system response is again too fast and too sharp. The desired poles are matched,
but the settling time is approximately 1.0 sec, faster than the specified the 1.5 sec. The percent
overshoot is approximately 10.9%, violating the 5% overshoot specification. Therefore, we need a pre-
filter.



0 1 2 3 4 5 6 7 8 9 10
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
y
(
t
)
t (sec)
67
Step 8. Include a pre-filter transfer function G
P
(s) if necessary.

Two unwanted zeros were introduced by the PID controller; these can be cancelled by a pre-filter.

Pre-filter transfer function
2
398.2
( )
33 147.2 398.2
P
G s
s s
=
+ +


Note the 398.2 numerator is included since the pre-filter shouldnt attenuate the output. Again plotting
the unit step responses, we now see that the performance specifications are met.


Example 2 PID Controller Open-, Closed-, and Closed-loop with pre-filter unit step responses



Open-Loop Closed-Loop PID Closed-Loop PID with Pre-Filter
t
R
= N/A sec t
R
= 0.05 sec t
R
= 0.55 sec
t
P
= sec t
P
= 0.16 sec t
P
= 1.15 sec
PO = NaN PO = 10.7% PO = 4.9%
t
S
= sec t
S
= 1.03 sec t
S
= 1.59 sec
e
SS
= e
SS
= 0% e
SS
= 0%


The pre-filtered closed-loop unit step response is theoretically identical to that of the Lead and
PID Controller Design Example 1 cases.


0 1 2 3 4 5 6 7 8 9 10
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
y
(
t
)
t (sec)
68
5.9 Controller Design Example 3 G(s) with a zero

This example uses a similar open-loop transfer function as in Controller Design Example 1, but
now G(s) includes an open-loop zero. This example is used to demonstrate a problem with controller
design via denominator parameter matching. The simple solution to this problem is also presented,
including a new concept for our standard controller design procedure. Since our existing controller
method will fail, we will jump into the process at Step 4 to save time. This example focuses on a PID
Controller, but the Lead Controller also experiences the same problem.

Step 4. State the controller design problem to be solved.

Given
2
5( 2)
( )
10
s
G s
s s
+
=
+ +
, H(s) =1,
3 2
( ) 32 157.2 398.2
DES
CL
s s s s A = + + + , ( )
I
C P D
K
G s K K s
s
= + +

Solve for the PID controller gains K
P
, K
I
, and K
D
. Then evaluate the PID controller performance.


Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop system.
Derive the closed-loop transfer function as a function of the PID controller gains.

2 2
2 2
2 2 2
2 2
2
2
5( )( 2) 5( )( 2)
( ) ( ) ( 10) ( 10)
( )
5( )( 2) ( 10) 5( )( 2) 1 ( ) ( ) ( )
1
( 10) ( 10)
5( )( 2)
( )
( 10) 5(
D P I D P I
C
D P I D P I C
D P I
D
K s K s K s K s K s K s
G s G s s s s s s s
T s
K s K s K s s s s K s K s K s G s G s H s
s s s s s s
K s K s K s
T s
s s s K s
+ + + + + +
+ + + +
= = =
+ + + + + + + + + +
+
+ + + +
+ + +
=
+ + +
2
3 2
3 2
)( 2)
5[ ( 2 ) ( 2 ) 2 ]
( )
(1 5 ) (1 5 10 ) (10 5 10 ) 10
P I
D P D I P I
D P D I P I
K s K s
K s K K s K K s K
T s
K s K K s K K s K
+ + +
+ + + + +
=
+ + + + + + + +


Match the symbolic form (function of K
P
, K
I
, K
D
) with the numerical desired characteristic
polynomial use the same third-order desired characteristic polynomial from Controller Design
Example 1, which is an augmented version of the second-order behavior with 5% overshoot and 1.5 sec
settling time.

Denominator parameter matching (fully-decoupled solution)
3
2
1
0
1 5 1
1 5 10 32
10 5 10 157.2
10 398.2
D
P D
I P
I
s K
s K K
s K K
s K
+ =
+ + =
+ + =
=


Due to the open-loop zero in G(s), this set of equations is overconstrained, i.e. 4 equations in
only three unknowns. In general there is no solution. What to do?
69
The solution to this dilemma is quite simple. In order to neutralize the effect of the open-loop
zero (or zeros in other examples) of G(s), simply introduce a new block into our standard closed-loop
feedback diagram, the internal pre-filter G
Pi
(s), as highlighted in red in the Simulink diagram below.
For this example this internal pre-filter G
Pi
(s) should be designed as follows:

10
( )
5( 2)
Pi
G s
s
=
+


That is, put the numerator of G(s) into the denominator of G
Pi
(s); also the numerator of G
Pi
(s) should be
the appropriate constant to avoid output attenuation. Then the controller design proceeds exactly as
done earlier for the PID controller in Example 1 without the troublesome zero included. This has been
done in class in the 3012 NotesBook and hence is not repeated here.


Standard Closed-Loop Feedback Block Diagram with Internal Pre-filter G
Pi
(s)

The Simulink output for this example is shown in the plot below.



Output Unit Step Responses
Original open-loop, Open-loop with zero,
PID controller, PID controller with Internal Pre-filter

70
In the above Simulink output response plots, we see that the open-loop unit step response with
the zero in magenta is changed significantly from the original open-loop response without the zero in
yellow. The unit step response of the PID feedback controller in red demonstrates that the internal pre-
filter is effective to cancel the effect of the open-loop zero and proceed with controller design in the
standard denominator parameter matching method. Interestingly, the same PID controller (whose
response is in sky blue) works almost as well without the new internal pre-filter G
Pi
(s). This may not be
a general result, but in this example it again shows the power of feedback control. The Simulink
diagram that generated these plots is given below.



Simulink Model for Above Responses

Note now there are two possible input efforts (see Section 5.12) to look at, the output of the
controller G
C
(s) and the output of the internal pre-filter G
Pi
(s). Both can be important in ME 3012
controls projects.

The internal pre-filter G
Pi
(s) can also be used to simplify higher-order systems (see Section
5.11) to second-order by including the higher-order factors in the numerator of the internal pre-filter. As
a combined example, consider the Robot Force Control open-loop transfer function given in Dr. Bobs
on-line Atlas of Models and Transfer Functions:

2 2
( ) ( 2.5)
( )
( ) ( 2 2)( 4 5)
F s K s
G s
s s s s s
+
= =
T + + + +


Where t(t) is the torque input and f(t) is the robot force output. This is a fourth-order system with a
zero. The combined internal pre-filter to cancel the effect of the zero and to simplify to a second-order
system is:

Step
Scope
PID
Same
PID Controller
398.2
31s +147.2s+398.2
2
Pre-filter
398.2
31s +147.2s+398.2
2
Pre-filter
s +s+10
2
5*[1 2]
Plant1
s +s+10
2
5*[1 2]
Plant
s +s+10
2
5*[1 2]
Plant
10
s +s+10
2
Plant
PID
PID Controller
10
5*[1 2]
Internal
Pre-filter
71
2
( 4 5)
( )
( 2.5)
Pi
s s
G s
s
+ +
=
+


We chose the second quadratic factor for the numerator of the internal pre-filter since that leaves the
more dominant mode first quadratic factor for controller design (it is slower, the second quadratic factor
is faster and hence less dominant).

This above internal pre-filter cannot be implemented in MATLAB or Simulink since the order of
the numerator is greater than the order of the denominator (it is non-causal). But the human can do the
cancelling and use the results in lower-order (second) system controller design.


72
5.10 Higher-Order System Controller Design

Parameter matching works well (with correction factor, if necessary, and a pre-filter) for Lead
and PID controllers when the original open-loop system is of second-order. However, if the open-loop
system is of third-order or higher, parameter matching will fail due to insufficient controller unknowns.

Example
3 2 2
10 10
( )
2 11 10 ( 1)( 10)
G s
s s s s s s
= =
+ + + + + +


Step 1. Analyze the as-given open-loop system behavior.

poles
1,2
0.5 3.12 s i =

3
1 s =

The second-order underdamped mode ( 0.158 = , 10 3.16
n
e = = rad/sec) from Controller
Design Example 1 is superimposed on a first order response with t =1 sec. Both modes are significant
(we cannot ignore either one).




Step 2. Specify and evaluate the desired behavior for the closed-loop system.
Using a dominant second-order desired characteristic polynomial for 5% overshoot and 1.5 sec
settling time, and adding two non-dominant negative real poles at least 10x higher (do not use 100x).
1,2
3
4
2.67 2.80
26.7
27.7
s i
s
s
=
=
=

4 3 2
( ) 60 1044 4753 11030
AUG
DES
s s s s s A = + + + +


Step 3. Specify the form for the controller transfer function.
PID Controller ( )
I
C P D
K
G s K K s
s
= + +


73
Step 4. State the controller design problem to be solved.

Given
3 2
10
( )
2 11 10
G s
s s s
=
+ + +
, H(s) = 1,
4 3 2
( ) 60 1044 4753 11030
AUG
DES
s s s s s A = + + + + , and
( )
I
C P D
K
G s K K s
s
= + + .

Solve for the PID controller gains K
P
, K
I
, and K
D
. Then evaluate the PID controller performance.


Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop system.

The closed-loop transfer function as a function of the PID controller gains result is

2
4 3 2
( ) ( ) 10( )
( )
1 ( ) ( ) ( ) 2 (11 10 ) (10 10 ) (10 )
C D P I
C D P I
G s G s K s K s K
T s
G s G s H s s s K s K s K
+ +
= =
+ + + + + + +


Attempt PID denominator parameter matching
4
3
2
1
0
1 1
2 60??!?
11 10 1044
10 10 4753
10 11030
D
P
I
s
s
s K
s K
s K
=
=
+ =
+ =
=


This denominator parameter matching fails! There are not enough dof in a PID controller. If we were to
ignore this problem and solve anyway, we get K
P
=474.3, K
I
=1103, and K
D
=103.3. Substituting
these values into T(s), the result is UNSTABLE due to two closed-loop poles with positive real parts.

This case is overconstrained, i.e. 4 equations but only 3 unknowns. In general, no solution
exists. What to do?

1. Simplify original open-loop system, if possible, to second-order and use parameter matching.

2. Do controller design by trial-and-error. This can be frustrating for the PID and Lead
controller because there are
3
possible solutions in each case! For the lead controller this can
be reduced to
2
possible solutions if you use the rule of thumb b =10a.

Try MATLABs rltool a beautiful tool for trial-and-error controller design.

Prior to resorting to trial-and-error, first try to simplify your higher-order system in one of two ways:

1. Control velocity instead of position, converting a third-order system to second-order.

2. Use the Internal Pre-Filter introduced in Section 5.10.

74
Alternate Step 5. Solve for the unknown gains using trial-and-error.

Demonstrate with MATLAB for the overconstrained third-order open-loop plant example.

num = [10];
den = [1 2 11 10];
bob = tf(num,den);
rltool(bob);


J ust like MATLAB function rlocus, give rltool the open-loop transfer function G(s) only,
then rltool will close the loop for you.

This m-code draws an interactive root-locus plot. Above the plot the current closed-loop
controller architecture is displayed with the following equivalences to ME 3012 standard notation.

name ME 3012 notation rltool notation
plant G(s) G(s)
sensor H(s) H(s)
controller (compensator) G
C
(s) C(s)
pre-filter G
P
(s) F(s)

On the root locus plot you can grab the square handle and slide it to change the gain K; the plot
displays in real-time where the closed-loop poles move. Choose some K value and use tools loop
responses to see the unit step response (among other options). How to choose K intelligently? Right-
click and choose Design Requirements to show grid lines for your performance specification choices.

To build the compensator piece-by-piece you can add real poles, add real zeros, add complex
poles, and/or add complex zeros. Remember open-loop poles migrate to open-loop zeros, so you may
wish to add some strategic zeros to attract those pesky poles that are causing trouble in your system
response.

Another good strategy: pole/zero cancellation place zeros right on top of any bad poles to
neutralize their effect. Caution This does not work for unstable poles (why?).

As you will see, this leads to endless hours of fun it can be frustrating too, so the suggestion to
simplify the open-loop system, if possible, is a good one.

To simplify your open-loop system, look at the poles if one or more pole are significantly
larger than the others, these larger ones can be ignored in favor of the lower, dominant poles. Modes
associated with the larger (negative real part) poles rise much faster in time, as we have seen. Divide
your original characteristic polynomial by the non-dominant factor(s) to simplify.

Step 6. Evaluate the PID controller performance in simulation.
Simulate, then re-design and re-evaluate your controller if necessary, repeating Steps 1 6.

75
Lower-Order System Controller Design

The opposite problem also exists. That is, if your system order is too low, the regular
denominator matching method will also fail due to insufficient equations.

For a first-order system, if you want to design a Lead or PID controller, T(s) will be of second-
order, but there are three unknown controller parameters in each case. This case is underconstrained,
i.e. only 2 equations but 3 unknowns. In general there are infinite solutions. You could set one gain
randomly and solve for the remaining two by denominator parameter matching. However, there are
better methods.

- Use a PI controller (PD will not work since the I term introduces an s in the denominator).
- Use a Lead controller, with the rule-of-thumb b =10a and thus eliminate an unknown.

Lead Controller Design Example, first-order system, negative unity feedback
10
( )
10
G s
s
=
+

( )
( )
( )
C
s a
G s K
s b
+
=
+
H(s) =1

2
10 ( )
( )
(10 10 ) (10 10 )
K s a
T s
s b K s b Ka
+
=
+ + + + +


Use a dominant second-order desired characteristic polynomial for 5% overshoot and 1.5 sec settling
time:
1,2
2.67 2.80 s i =

2
( ) 5.33 14.93
DES
s s s A = + +

Denominator parameter matching
2
1
0
1 1
10 10 5.33
10 10 14.93
s
s b K
s b Ka
=
+ + =
+ =


This system of nonlinear equations is underconstrained, 2 equations in 3 unknowns K, a, b. Let b =10a.
1 0.533
(10 ) 1.493
a K
a K
+ + =
+ =


Now we have 2 nonlinear equations in the 2 unknowns K and a. The solution is:
9.84
9.37
93.7
K
a
b
=
=
=


so there is no need for trial-and-error or rltool in this case. Due to the negative gain K, the correction
factor (Step 7, not shown) will also be negative.

A PID controller has similar problems (use a PI or PD controller since a PID controller has one
too many unknowns with 3).

76
5.11 Closed-Loop Controller Input Effort

Closed-Loop Controller Input Effort Examples

We now return to the Controller Design Examples 1, with the Lead controller (without and with
pre-filter) and the PID controller (without and with pre-filter).



Simulink Model for open-loop, Lead, and PID Input Effort Simulation


77
Lead Controller



Output Unit Step Responses

Open-loop, non-pre-filtered Lead, pre-filtered Lead


78


Lead Controller Input Effort (entire scale)

Open-loop (1), non-pre-filtered Lead (52.4), pre-filtered Lead (1.1)

79


Lead Controller Input Effort (zoomed in)

Open-loop (1), non-pre-filtered Lead (52.4), pre-filtered Lead (1.1)
80
PID Controller



Output Unit Step Responses

Open-loop, non-pre-filtered PID, pre-filtered PID


81


PID Controller Input Effort (entire scale)

Open-loop (1), non-pre-filtered PID (324.7), pre-filtered PID (1.2)


82


PID Controller Input Effort (zoomed in)

Open-loop (1), non-pre-filtered PID (324.7), pre-filtered PID (1.2)


Input effort discussion

All open-loop input efforts are simply unit step inputs, shown for comparison purposes. Without
pre-filtering, the input effort required for the Lead and PID controllers is huge (peaks of greater than 50
and greater than 300, respectively), so large we cannot see the details for the other curves on those plots.
The pre-filtered Lead and PID controllers require maximum input efforts of just over 1 and nearly 1.2,
respectively, a dramatic difference!

Similarly, the non-pre-filtered Lead and PID controllers require very fast changing of the input
actuator values, which may exceed physical capabilities of the real-world actuator. The pre-filtered
Lead and PID controllers do not require these radical rates of change for the actuator input efforts.


83
5.12 Disturbance Evaluation after Controller Design

General disturbance diagrams (open- and closed-loop)




Disturbance diagram with zero reference input
This is called a regulator, where the desired output (reference input) is R(s) =0.

Change this into a diagram that looks more similar to the standard closed-loop feedback diagram.


The closed loop transfer function between the disturbance input D(s) and Y(s) output is:
( ) ( )
( )
( ) 1 ( ) ( ) ( )
D
C
Y s G s
T s
D s G s G s H s
= =
+


This is for MATLAB implementation, to simulate the effects of the disturbance input separately.
Then use linear superposition in MATLAB to find the total solution as the sum of the reference input
response (with zero disturbance) plus the disturbance input (with zero reference input).

G(s)
Y(s) U (s) U(s)
D(s)
D
-
G(s)
H(s)
G (s)
R(s) E(s) Y(s) U (s)
Y (s)
C
SENS Y(s)
U(s)
D(s)
D
G(s)
H(s)
G (s)
E(s) Y(s) U (s)
Y (s)
C
SENS Y(s)
U(s)
D(s)
D
-1
G(s)
H(s) G (s)
E(s)
Y(s) U (s)
Y (s)
C
SENS Y(s)
U(s)
D(s)
D
-1
+
+
84
Controller Design with Disturbances (one possible strategy for use in ME 3012)
1. Design the controller as before with no disturbances then evaluate in simulation.
2. For the same controller(s), now apply a disturbance and evaluate how well the controller
rejects the disturbance vs. the open-loop system, both with zero reference input.
3. Repeat 2, apply a disturbance and evaluate how well the controller rejects the disturbance vs.
the open-loop system, now with non-zero reference input.

One can test open- vs. closed-loop disturbance rejection behavior with various disturbances of
different functions (impulse, step, ramp, sine wave, random, etc.), magnitudes, and times of application.
Choose whatever makes the best sense for your real-world application.


Pre-filtered PID Controller Example 1 with Disturbances
For open- and closed-loop disturbance rejection evaluation we now use the model and PID
controller design results for Controller Example 1, presented earlier. The desired behavior was designed
for 5% overshoot and 1.5 sec settling time, augmented for a third-order desired characteristic
polynomial. The PID controller was designed using denominator polynomial matching and a pre-filter
was required but no correction factor, thanks to the I term.




Simulink Model for open-loop, disturbed open-loop,
pre-filtered PID, and disturbed pre-filtered PID


For this simulation we specify a unit step disturbance that adds to the actuator input, turned on at
t =1 sec, whereas the basic open- and closed-loop step input turned on a t =0 sec.

Step
Scope
398.2
31s +147.2s+398.2
2
Pre-filter
398.2
31s +147.2s+398.2
2
Pre-filter
PID
PID Controller
PID
PID Controller
10
s +s+10
2
OL no dist
10
s +s+10
2
OL dist
Dist
10
s +s+10
2
CL no dist
10
s +s+10
2
CL dist
85


Open-loop, disturbed open-loop, pre-filtered PID, disturbed pre-filtered PID


This Simulink simulation shows that the open-loop system cannot deal with the disturbance at t =
1 sec since the open-loop transient response phase shifts and the steady state error is 100%. In contrast,
the closed-loop PID controller is also disturbed at t =1 sec, but the closed-loop output relatively quickly
returns to the designed trajectory. Thus, the PID controller disturbance rejection is much better than that
of the open-loop system.


Pre-filtered Lead and pre-filtered PID Controller Example 1 with Disturbances
To compare the closed-loop disturbance rejection of different controllers, we now use the same
model and Lead vs. PID controller design results from Controller Example 1, all presented earlier.

86


Lead, disturbed Lead, PID, disturbed PID


Here the output responses of the pre-filtered closed-loop Lead and PID controllers are identical.
Since they are designed based on the augmented third-order system, there is only a little error,
essentially achieving the desired 5% overshoot and 1.5 sec settling time.

After the unit step disturbance is turned on at t =1 sec, we see that only the PID controller can
handle it well. The Lead controller (magenta) has good transient dynamics under the disturbance but
nearly 80% steady-state error.

Thus, the PID controller disturbance rejection is much better than that of the Lead controller in
this example. The PID controller was not designed for disturbance rejection, it just handles the
disturbances better.


87


Simulink Model for corrected pre-filtered Lead and pre-filtered PID Controllers,
without and with Disturbances


88
5.13 Whole T(s) Matching Controller Design The J-Method
Standard negative feedback closed-loop block diagram


Summary of controller design via parameter matching
- Step 1. Analyze the as-given open-loop system behavior.
- Step 2. Specify and evaluate the desired behavior for the closed-loop system. This step
yields a numerical desired characteristic polynomial for the T(s) denominator, called A
DES
(s).
- Step 3. Specify the form for the controller transfer function. Assume a standard form for
your controller G
C
(s).
- Step 4. State the controller design problem to be solved.
- Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop
system. Derive closed-loop transfer function as a function of controller gains and parameters:
( ) ( )
( )
1 ( ) ( ) ( )
C
C
G s G s
T s
G s G s H s
=
+

- Match the symbolic parameters in the denominator of T(s) with your numerical desired
characteristic polynomial term-by-term according to s powers (make sure both
polynomials have the same leading coefficient for the highest s power).
- Solve for the controller unknowns, determine the correction factor (if necessary),
determine the pre-filter transfer function G
P
(s) (if necessary), and simulate the resulting
performance.
- Step 6. Evaluate the controller performance in simulation.
- Step 7. Include an output attenuation correction factor if necessary.
- Step 8. Include a pre-filter transfer function G
P
(s) if necessary.
- Repeat Step 6.
- Step 9. Re-design and re-evaluate the controller if necessary, if the performance specs are
not met.

There are possible drawbacks with this method, the biggest being: the order of the closed-loop system
must match the number of controller unknowns. If the number of unknowns is less, there is no solution
(overconstrained) and if the number of unknowns is greater, there are infinite solutions
(underconstrained). In either of the mismatch cases we can use trial-and-error controller design. This
can be frustrating and ineffective since there are
n
solutions, where n is the number of controller
unknowns. See Section 5.10 in this Supplement.
Further drawbacks include the need for most standard controllers to add a correction factor for
output attenuation and a pre-filter transfer function G
P
(s) to cancel the unwanted introduced zero(s).
There is a potentially better method, here called the whole T(s) Matching Controller Design, or
simply the J -Method. This is named after ME student Jason Denhart who, in Spring 2008, posed the
question Why cant we just specify the entire numerical T(s) and solve for the exact G
C
(s) necessary to
provide that T(s)?
-
G(s)
H(s)
G (s)
R(s) E(s) Y(s) U(s)
Y (s)
C
SENS Y(s)
89
The J-Method
- Step 1. Analyze the as-given open-loop system behavior.
- Step 2. Specify and evaluate the desired behavior for the closed-loop system. This step
yields a numerical desired characteristic polynomial for the T(s) denominator (see Note 1 below),
plus the desired T(s) numerator.
- Step 3. State the controller design problem to be solved. The former Step 3 is skipped, i.e.
the J -Method determines the controller form in the solution procedure so there is no need to
assume a standard controller form for G
C
(s).

Given The plant and sensor transfer functions G(s) and H(s) in the context of our
standard closed-loop negative feedback diagram.
The desired closed-loop behavior, expressed by a whole numerical T(s) (as
opposed to the desired closed-loop characteristic polynomial only as before).
Find The form and the unknowns (gains) of the controller transfer function G
C
(s).

- Step 4. Solve for the unknown controller form including the unknown gains. Use the
standard equation
( ) ( )
( )
1 ( ) ( ) ( )
C
C
G s G s
T s
G s G s H s
=
+


Substitute your whole numerical desired T(s), plus the known numerical plant and sensor transfer
functions G(s) and H(s), and solve for the unknown controller transfer function G
C
(s), without
the need to assume a certain controller form.
( )
( )
( )(1 ( ) ( ))
C
T s
G s
G s H s T s
=



- Step 5. Simulate the resulting closed-loop system performance.
- Step 6. Re-design and re-evaluate if necessary, if the performance specs are not met.

Notes
1. The order of the denominator of your desired T(s) must be equal or greater than the order of the
denominator of G(s). If the G(s) denominator is of higher order than the T(s) denominator, your
resulting G
C
(s) will have a higher order in the numerator than the denominator, which is impossible to
implement in MATLAB or Simulink, unless it happens to boil down to a PID form.
2. You do not need a correction factor this is loaded into your desired T(s).
3. You do not need a pre-filter transfer function G
P
(s) since we are matching the entire desired T(s).
4. The resulting controller G
C
(s) will not necessarily be of any recognizable classical controller form.
5. MATLAB was used to help with the algebra (either symbolically or numerically). This should work;
however, problems were encountered with large integers and excessive controller numerator and
denominator orders.
6. If you follow the requirement for T(s) denominator order and make no algebra mistakes, the
performance you obtain will be theoretically identical to a good classical controller with appropriate pre-
filter and correction factor.
7. There are three major drawbacks of the J -Method
- The J -Method does not handle disturbances well, as most other controllers do (presented later).
- The J -Method requires perfect knowledge of the open-loop plant, which is impossible. Thus, it
is less robust to modeling uncertainties than other controllers.
- The J -Method cannot handle unstable open-loop plants (this is no problem for other controllers).
90
Controller Design Example 1 The J-Method
Step 1. Analyze the as-given open-loop system behavior.
This step is the same as in Controller Example 1, with
2
10
( )
10
G s
s s
=
+ +
.

Step 2. Specify and evaluate the desired behavior for the closed-loop system, to achieve 5%
overshoot and 1.5 sec settling time. We have used these performance specifications before; the
associated desired whole closed-loop transfer function is (assuming a final value of 1 is desired from a
unit step input):
2
14.93
( )
5.33 14.93
T s
s s
=
+ +


Step 3. State the controller design problem to be solved.
Given
2
10
( )
10
G s
s s
=
+ +
, H(s) =1, and
2
14.93
( )
5.33 14.93
T s
s s
=
+ +

Solve for G
C
(s) via whole T(s) matching.

Step 4. Solve for the unknown controller form including the unknown gains.


























The result is
2
1.493( 10)
( )
( 5.33)
C
s s
G s
s s
+ +
=
+

What type of controller is this?
How does the J -Method controller work?
91
Step 5. Simulate the resulting closed-loop system performance.
Simulink Evaluation for the J-Method Controller Design Example 1



Simulink simulation results


Open-Loop Closed-Loop J -Method

There is no need for a correction factor or pre-filter.

Step1
Step
Scope
10
s +s+10
2
Plant2
10
s +s+10
2
Plant1
s +5.33s
2
1.493*[1 1 10]
Gc
92
Examples
To rigorously test the J -Method, the following three open-loop transfer functions G(s) and the
following three desired whole closed-loop transfer functions T(s) were chosen, to be mixed-and-matched
for a total of 9 examples.
G(s) T(s)
1.
1
1 s +
a.
2
2 s +

2.
2
10
10 s s + +
b.
2
15
6 15 s s + +

3.
2
10
( 1)( 10) s s s + + +
c.
3 2
450
36 195 450 s s s + + +


- The whole desired T(s) in a. is based on a time constant of t =0.5 sec.
- The whole desired T(s) in b. started from our familiar specification of 5% overshoot and 1.5 sec
settling time (leading to a dominant second-order desired denominator of
2
5.33 14.93 s s + + ). But
I wanted nice integers for the multiple example combinations, so this one corresponds to 2.13%
overshoot and 1.38 sec settling time ( =0.78, e
n
=3.87 rad/s, and
1,2
3 2.45 s i = ).
- The whole desired T(s) in c. started from b., augmenting the denominator with a third pole
3
30 s = , so approximately the same dominant second-order behavior will result (2.13%
overshoot and 1.38 sec settling time).
- All whole desired T(s) in a., b., and c. artificially obtain a steady state value of 1 give a unit step
input function, with selection of the numerator constant to match the denominator spring.

Lets do a few of these examples now. Assume unity negative feedback for all examples.

Example 1a
Given open-loop plant
1
( )
1
G s
s
=
+
, ideal sensor transfer function H(s) =1, and desired whole
2
( )
2
T s
s
=
+
, determine G
C
(s) via whole T(s) matching:













Answer
2( 1)
( )
C
s
G s
s
+
= (what kind of controller is this?)

93
Simulink simulation results



Open-Loop Closed-Loop J -Method

The open-loop time constant of t =1 sec is halved to the closed-loop time constant of t =0.5 sec, which
doubles the speed of the closed-loop system to reach 95% of the final value of 1.
94
Example 1b
Given open-loop plant
1
( )
1
G s
s
=
+
, ideal sensor transfer function H(s) = 1, and desired whole
2
15
( )
6 15
T s
s s
=
+ +
, determine G
C
(s) via whole T(s) matching:















Answer
15( 1)
( )
( 6)
C
s
G s
s s
+
=
+
(what kind of controller is this?)


95
Simulink simulation results



Open-Loop Closed-Loop J -Method

The open-loop time constant was t =1 sec and the desired closed-loop performance specs of 2.13%
overshoot and 1.38 sec settling time are met in simulation.

96
Example 2a
Given open-loop plant
2
10
( )
10
G s
s s
=
+ +
, ideal sensor transfer function H(s) =1, and desired whole
2
( )
2
T s
s
=
+
, determine G
C
(s) via whole T(s) matching.















Answer
2
10
( )
5
C
s s
G s
s
+ +
= (what kind of controller is this?)
This is an exception to the rule that the T(s) denominator must of order equal or greater than the order of
the G(s) denominator, since it is a PID controller.


97
Simulink simulation results



Open-Loop Closed-Loop J -Method

The open-loop behavior is the familiar stable underdamped system and the closed-loop time constant is
t =0.5 sec which allows closed-loop system to reach 95% of the final value of 1 in 1.5 sec, thus meeting
the design goals in simulation.
98
Examples Summary Table

For the combinations of examples considered, the table below summarizes the numerator and
denominator orders using the J -Method. Also given is the resulting form of the controller transfer
function G
C
(s) (n.r.f. stands for no recognizable form).

T(s)
a. 1
st
-order b. 2
nd
-order c. 3
rd
-order




G(s)

1
st

st
st
1
1
, PI
st
nd
1
2
, Lead/I
st
rd
1
3
, n.r.f.

2
nd

nd
st
2
1
, PID
1
nd
nd
2
2
, n.r.f.

nd
rd
2
3
, n.r.f.


3
rd

rd
st
3
1
, n.r.f.
2
rd
nd
3
2
, n.r.f.
2
rd
rd
3
3
, n.r.f.



Examples G
C
(s) Summary

For the nine example combinations considered, the table below summarizes the resulting
controller transfer functions G
C
(s) using the J -Method.

T(s)
a. 1
st
-order b. 2
nd
-order c. 3
rd
-order






G(s)


1
st


2( 1) s
s
+


15( 1)
( 6)
s
s s
+
+


2
450( 1)
( 36 195)
s
s s s
+
+ +



2
nd


2
10
5
s s
s
+ +

1

2
1.5( 10)
( 6)
s s
s s
+ +
+



2
2
45( 10)
( 36 195)
s s
s s s
+ +
+ +



3
rd


3 2
2 11 10
5
s s s
s
+ + +

2

3 2
1.5( 2 11 10)
( 6)
s s s
s s
+ + +
+

2

3 2
2
45( 2 11 10)
( 36 195)
s s s
s s s
+ + +
+ +



1
Exception to the rule that the order of the denominator of your desired T(s) must be equal or greater
than the order of the denominator of G(s).

2
Impossible to implement.


99
In addition to this set of nine examples, the J -Method has been successfully tested with the following
(where the a-c cases represent the same desired closed-loop transfer functions as above).

- Integrating open-loop transfer function G(s) (an s can be factored out in the denominator, i.e.
there is no spring). This is called a Type I system since there is one integrator in the
denominator of G(s), as explained in Section 4.5 of the 3012 NotesBook.
2
10 10
( )
( 1)
G s
s s s s
= =
+ +


a.
1
( )
5
C
s
G s
+
= b.
1.5( 1)
( )
( 6)
C
s
G s
s
+
=
+
c.
2
45( 1)
( )
36 195
C
s
G s
s s
+
=
+ +

PD Lead n.r.f.


- Non-ideal sensor transfer function ( ) 1 H s =
1
( )
4
H s
s
=
+
for
1
( )
1
G s
s
=
+


a.
2
2
2( 5 4)
( )
6 6
C
s s
G s
s s
+ +
=
+ +
b.
2
3 2
15( 5 4)
( )
10 39 45
C
s s
G s
s s s
+ +
=
+ + +
c.
2
4 3 2
450( 5 4)
( )
40 339 1230 1350
C
s s
G s
s s s s
+ +
=
+ + + +



- Open-loop transfer function G(s) with a zero
2
10( 1)
( )
10
s
G s
s s
+
=
+ +


a.
2
10
( )
5 ( 1)
C
s s
G s
s s
+ +
=
+
b.
2
2
1.5( 10)
( )
( 7 6)
C
s s
G s
s s s
+ +
=
+ +
c.
2
3 2
45( 10)
( )
( 37 231 195)
C
s s
G s
s s s s
+ +
=
+ + +



- Unstable open-loop transfer function G(s), e.g. Controller Design Example 2
2
10
( )
10
G s
s s
=
+


a.
2
10
( )
5
C
s s
G s
s
+
= b.
2
1.5( 10)
( )
( 6)
C
s s
G s
s s
+
=
+
c.
2
2
45( 10)
( )
( 36 195)
C
s s
G s
s s s
+
=
+ +



Try all of these in Simulink simulation to evaluate their performance.

All examples work as desired except for the unstable cases which all have numerical instability
problems, with the negative K
P
gains the unstable poles cannot be cancelled perfectly. So we
CANNOT use the J-Method for unstable open-loop systems.

100
Note that the full-T(s)-matching J -Method does not experience any problems with handling
open-loop G(s) models with zeros or higher-order systems. The J -Method controller includes its own
internal pre-filter, identical to the one presented in Section 5.9.

Also, problems of denominator parameter matching with higher-order and lower-order systems
as exposed in Section 5.10 are not a problem for the J -Method.

J-Method Controller Input Effort

For Controller Design Example 1, we first present the output unit step response, followed by the
input effort plot, both in comparison to the open-loop case.



Output Unit Step Responses

Open-loop, J-Method Controller


101


J-Controller Input Effort

Open-loop (1), J-Method Controller (1.5)


The J -Method requires no pre-filter its maximum input effort requirement is 1.5 actuator input
units. The J -Method controller does not require a steep rate of change for the actuator input effort.


102
J-Method Controller Disturbance Evaluation

Again for Controller Design Example 1, we now present how well the J -Method rejects
disturbances.



J-Method, disturbed J-Method

A unit step disturbance was turned on at t =1 sec. Clearly the J -Method controller is very poor
at rejecting the disturbance in this example. The disturbed J -Method controller overshoots relatively
high, with poor transient dynamics. This disturbed response is heading towards zero steady-state error,
however, given enough time.

The PID controller disturbance rejection presented in Section 5.12 is much better than that of the
Lead or J -Method controllers in this example. The PID controller was not designed for disturbance
rejection, it just handles the disturbances better.


103
5.14 Term Example Controller Design

Open-loop system physical diagram


We will design a controller to control the load angular velocity e
L
(t). Assume a perfect
tachometer sensor, H(s) =K
t
=1, so there is negative unity feedback. Note that G
2
(s) =K
T
, the motor
torque constant, is different from H(s) =K
t
, the feedback sensor (tachometer) constant. Here are the
open- and closed-loop feedback control system diagrams.


Term Example Open-Loop Diagram


Term Example Closed-Loop Diagram

where
1
1
( ) G s
Ls R
=
+

2
( )
T
G s K =
3
1
( )
E E
G s
J s c
=
+

H(s) =K
t
=1

J
M
c
M
J (t)
L
c
L
n
v (t)
A
i (t)
A
v (t)
B
+
-
+
-
L R
t
e
u
L
L
L
(t)
(t)
(t)
t
e
u
M
M
M
(t)
(t)
(t)
-
G (s)
1
G (s)
3
1/n G (s)
2
K
B
V (s)
A
I (s)
A
T (s)
M
(s)
M
O
(s)
L
O
-
G (s)
1
G (s)
3
1/n G (s)
2
K
B
V (s)
A
I (s)
A
T (s)
M
(s)
M
O
(s)
L
O
-
(s)
LDES
O
K
t
104
Step 1. Analyze the as-given open-loop system behavior.

Earlier the open-loop transfer function was derived and the real-world parameters for the NASA
ARMII robot shoulder joint were substituted.
( ) ( )
2
( ) 5
( )
( ) 11 1010
T
L
A E E T B
K
s
n
G s
V s Ls R J s c K K s s
e
O
= = ~
+ + + + +


( )
2 2 2
2 11 1010
OL n n
s s s s s e e A = + + = + +

1010 31.8
n
e = = rad/sec
11 11
0.173
2 2 1010
n

e
= = =
1,2
5.5 31.3 s i =

t
R
=0.04 sec t
P
=0.10 sec PO =57.6% t
S
=0.71 sec

This open-loop system has a different time scale than Controller Design Example 1; its output
e
L
(t) rises much faster in response to a unit step input v
A
(t). Also, the steady-state value is 5/1010,
whereas it was 1.0 for Controller Design Example 1.




105
First, take a look at the root-locus plots and unit step responses, for the proportional controller G
C
(s) =
K, first for angular velocity output.




Term Example, e
L
(t) control, unit step responses as K increases from 0.

K values legend
0 52 96
179 334 622
-50 0 50
-50
-40
-30
-20
-10
0
10
20
30
40
50
Re
I
m
e
L
Root Locus
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
StepResponse
Time (sec)
A
m
p
litu
d
e
106
Here are the root-locus plot and unit step responses, for the proportional controller G
C
(s) =K, for angle.




Term Example, u
L
(t) control, unit step responses as K increases from 0.
K values legend
0 20 117
681 2220 3955
9529 55309 220190

The closed-loop system becomes unstable for 2222 K > ! Clearly the simple proportional controller will
not work, since the angular velocity root-locus plot shows that the closed-loop dimensionless damping
ratio must decrease as K increases.
-50 0 50
-50
-40
-30
-20
-10
0
10
20
30
40
50
Re
I
m
u
L
Root Locus
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
0
0.02
0.04
0.06
0.08
0.1
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
0
0.1
0.2
0.3
0.4
0.5
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
0
0.2
0.4
0.6
0.8
1
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
0
0.5
1
1.5
2
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
-10
-5
0
5
10
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
x 10
4
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
x 10
11
StepResponse
Time (sec)
A
m
p
litu
d
e
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
x 10
20
StepResponse
Time (sec)
A
m
p
litu
d
e
107
Step 2. Specify and evaluate the desired behavior for the closed-loop system.
To determine the numerical desired characteristic polynomial, lets try something different:
ITAE third-order. Arbitrarily let e
n
=5.
3 2 2 3 3 2
( ) 1.75 2.15 8.75 53.75 125
DES n n n
s s s s s s s e e e A = + + + = + + +

The associated desired closed-loop poles from third-order ITAE are 2.60 5.34, 3.54 i .

Step 3. Specify the form for the controller transfer function.
PID Controller
2
( )
I D P I
C P D
K K s K s K
G s K K s
s s
+ +
= + + =

Step 4. State the controller design problem to be solved.
Given
2
5
( )
11 1010
G s
s s
=
+ +
, H(s) = 1,
3 2
( ) 8.75 53.75 125
DES
CL
s s s s A = + + + , and
( )
I
C P D
K
G s K K s
s
= + + , Solve for the PID controller gains K
P
, K
I
, and K
D
. Then evaluate the PID
controller performance.

Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop system.
Derive the closed-loop transfer function as a function of the PID controller gains.
( )
( )
( )
( )
( )
( )
( ) ( )
( )
( )
( ) ( )
( )
2 2
2 2
2 2 2
2 2
2
2 2
2
3
5 5
11 1010 11 1010
( ) ( )
( )
1 ( ) ( ) 5 11 1010 5
1
11 1010 11 1010
5
( )
11 1010 5
5
( )
D P I D P I
C
C D P I D P I
D P I
D P I
D P I
K s K s K K s K s K
s s s s s s
G s G s
T s
G s G s K s K s K s s s K s K s K
s s s s s s
K s K s K
T s
s s s K s K s K
K s K s K
T s
s
+ + + +
+ + + +
= = =
+ + + + + + + +
+
+ + + +
+ +
=
+ + + + +
+ +
=
+( ) ( ) ( )
2
11 5 1010 5 5
D P I
K s K s K + + + +


Match the symbolic form (function of K
P
, K
I
, K
D
) with the numerical ITAE desired characteristic
polynomial.

Denominator parameter matching (fully-decoupled solution)
3
2
1
0
1 1
11 5 8.75
1010 5 53.75
5 125
D
P
I
s
s K
s K
s K
=
+ =
+ =
=

0.45
191.25
25
D
P
I
K
K
K
=
=
=

K
P
and K
D
are negative!

108
Step 6. Evaluate the PID controller performance in simulation.
Open- vs. Closed-Loop unit step responses

Open-Loop Closed-Loop PID

Step 7. Include an output attenuation correction factor if necessary.
Here the K
I
term forces the steady-state output to 1.0 (zero steady-state error for unit step input);
however, the original system output was not 1.0 (it was 5/1010, we cant even see it on the graph), so we
need a correction factor to drive the closed-loop system to the same steady-state value (right plot).
51010
( ) ( )( ) ( ) ( ) 0.00495 ( )
1
sso
corr
ssc
y
R s R s corr R s R s R s
y
= = = =

Corrected closed-loop PID transfer function
2
3 2
5 2.25 956.25 125
( )
1010 8.75 53.75 125
s s
T s
s s s
| | + +
=
|
+ + +
\ .


Again: Controller design can easily make matters worse, if not done properly! With negative K
P
,
the closed-loop step response initially goes down while open-loop goes up. The is a huge (negative)
overshoot, and the transient response is slower than the open-loop case.

Step 9. Re-design and re-evaluate the controller.
Perform design iteration until the closed-loop performance specifications are met in simulation.
We have no pre-filter yet (Step 8), but we have a bigger problem in the negative K
P
and K
D
.

Step 2. Specify and evaluate the desired behavior for the closed-loop system.
So lets choose a higher e
n
in the third-order ITAE desired closed-loop numerical characteristic
polynomial for faster response and positive K
P
, K
D
. K
P
is the limiting case, i.e. if we force it to be
positive, K
D
will be positive also.
11 5 1.75
D n
K e + =

@ K
D
=0, e
n
=6.29, but then K
P
will still be negative (K
P
=185); therefore let us instead set e
n
so
that K
P
will be positive.
2
1010 5 2.15
P n
K e + =

@ K
P
=0, e
n
=21.7
So try e
n
=30
3 2
( ) 52.5 1935 27000
DES
s s s s A = + + +

0 0.5 1 1.5 2 2.5 3
-16
-14
-12
-10
-8
-6
-4
-2
0
2
4
e
L
(
t
)
t (sec)
0 0.5 1 1.5 2 2.5 3
-0.08
-0.07
-0.06
-0.05
-0.04
-0.03
-0.02
-0.01
0
0.01
0.02
e
L
(
t
)
t (sec)
109
The new associated desired closed-loop poles from third-order ITAE are 15.63 32.04 , 21.24 i

Step 5. Solve for the unknown gains to achieve the desired behavior for the closed-loop system.
Denominator parameter matching (fully-decoupled)
3
2
1
0
1 1
11 5 52.5
1010 5 1935
5 27000
D
P
I
s
s K
s K
s K
=
+ =
+ =
=

8.3
185
5400
D
P
I
K
K
K
=
=
=

K
P
and K
D
are both positive as planned!

Step 6. Evaluate the PID controller performance in simulation.

Open- vs. Closed-Loop unit step responses


Open-Loop Closed-Loop PID


Closed-loop transfer function
2
3 2
5 42 925 27000
( )
1010 52.5 1935 27000
s s
T s
s s s
| | + +
=
|
+ + +
\ .



Step 7. Include an output attenuation correction factor if necessary.
We include the same correction factor as above.

The controller response is much better with the positive K
P
and K
D
, but the third-order bend in
the closed-loop response is not as desired. The desired ITAE response is different, i.e. it doesnt look
like this closed-loop response. Therefore, we need a pre-filter.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
2
3
4
5
6
7
8
x 10
-3
e
L
(
t
)
t (sec)
Open- vs. PID Closed-Loop e
L
Response, Corrected
110
Step 8. Include a pre-filter transfer function if necessary.

Two unwanted zeros were introduced by the PID controller; these can be cancelled by a pre-
filter.

Pre-filter transfer function
2
27000
( )
42 925 27000
P
G s
s s
=
+ +


Note we specify the 27000 pre-filter transfer function numerator since the pre-filter shouldnt attenuate
the output. When we plot the resulting unit step responses we see in the left plot below that the
controller design is now successful.


Open-Loop Closed-Loop PID Closed-Loop PID with Pre-Filter

The pre-filtered closed-loop transfer function is:

3 2
5 27000
( )
1010 52.5 1935 27000
T s
s s s
| |
=
|
+ + +
\ .


The final closed-loop unit step response is now theoretically identical to the specified third-order
ITAE behavior. Note with the ITAE specification we didnt need to specify percent overshoot, settling
time, or peak time.

For this controller, the angle u
L
(t) unit step response in time is given in the right plot above (note
the steady-state error since the closed-loop PID lags the open-loop and the closed-loop PID with pre-
filter lags even further). We just integrated the e
L
(t) response to get these results, i.e. we included
another s factor in the closed-loop system denominator.


0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
1
2
3
4
5
6
7
8
x 10
-3
e
L
(
t
)
t (sec)
Open-, PID Closed-, and Pre-filtered e
L
Response
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
x 10
-3
u
L
(
t
)
t (sec)
Open-, PID Closed-, and Pre-filtered u
L
Response
111
Step 6. Evaluate the PID controller performance in simulation.

Simulink Model




The Plant blocks above are Simulink masks for the (identical) open-loop plant shown below.


V
ThetaL
Reference
OmegaL
27000
42s +925s+27000
2
Pre-filter Plant
Plant
PID
PID Controller
OmegaL
1
s
Integrator2
1
s
Integrator
-K-
Corr
1
out_1
tau dist
1
s+10
RL Circuit
100
Km
1
Kb
1
0.1s+0.1
J c rotational dynamics
-K-
1/n
1
in_1
112
J-Method Controller
Alternate design method for Term Example e
L
(t) controller design.

Step 2. Specify the desired behavior for the closed-loop system We specify the entire desired closed-
loop T(s), not just the denominator. To determine the numerical desired entire closed-loop T(s) transfer
function, lets try something different: ITAE second-order.

2 2
2
( ) 1.4
( ) 42 900
DES n n
DES
s s s
s s s
e e A = + +
A = + +
e
n
=30 (from successful PID controller design)
The associated desired closed-loop poles from third-order ITAE are 21 21.4i .

2
5(900)
1010
( )
42 900
T s
s s
=
+ +


Step 4. Solve for the unknown controller form including the unknown gains. J-Method

( )
( )
( )
( ) 1 ( ) ( )
C
T s
G s
G s H s T s
=



with
2
5
( )
11 1010
G s
s s
=
+ +
and H(s) =1

( )
2
2 2
2
2
2
2
2
2
5(900)
1010
42 900
( )
5(900)
5
1010
1 (1)
11 1010 42 900
450
11 1010
101
42 900 5
( )
450
42 900
101
42 900
90
11 1010
101
( )
42 450 2
C
C
C
s s
G s
s s s s
s s
s s
G s
s s
s s
s s
G s
s s
+ +
=
| |
|
| |

| |
+ + + +
\ .
|
\ .
| |
|
| | + +
| |
+ +
\ .
|
\ .
=
| |
+ +
|
|
+ +
|
\ .
+ +
=
+ +
1
101
| |
|
\ .

113
Step 5. Simulate the resulting closed-loop system performance.

Simulink Evaluation for the J-Method Term Example Controller Design, Angular Velocity






Open-Loop Closed-Loop J -Method

Step
Scope
5
s +11s+1010
2
Plant
5
s +11s+1010
2
Plant
s +42s+450*(2-1/101)
2
90/101*[1 11 1010]
Gc
114


Open-Loop Closed-Loop J -Method Disturbed Closed-Loop J -Method


There is no need for a correction factor or a pre-filter transfer function.


This J -Method controller for the Term Example load shaft angular velocity e
L
(t) control was
successful as shown in the left plot above. But how does this controller handle disturbances?

As we have seen before, the J -Method controller is very poor at handling disturbances, in this
case a unit step disturbance in voltage, subtracted at t =1 sec. The disturbed J -Method controller output
response, shown in the right figure above, has unacceptable transient response and unacceptable steady-
state error.


115
5.15 Term Example Disturbances and Steady-State Error



Though we have not presented it, it is possible to design controllers specifically to reject
disturbances. This last example, the conclusion of the Term Example, discusses controller design to
reject disturbances, specifically for achieving lower steady-state error.

Term Example open-loop diagram with disturbance

where V
A
(s) is the armature voltage input, O
L
(s) is the load shaft angular velocity output, and D(s) is the
disturbance modeled at the actuator input level (disturbance in torque, Nm).

where
1
1
( ) G s
Ls R
=
+

2
( )
T
G s K =
3
1
( )
E E
G s
J s c
=
+


Let V
A
(s) =0 and monitor changes in O
L
(s) given a disturbance input. Since V
A
(s) =0, any O
L
(s)
is the steady-state error, that is, we wish as low an output as possible for the open-loop system.

Derive the open-loop disturbance transfer function
( )
( )
( )
L
D
s
G s
D s
O
= .

( ) 1
( ) ( )
M
M E E
s
T s D s J s c
O
=
+


J
M
c
M
J (t)
L
c
L
n
v (t)
A
i (t)
A
v (t)
B
+
-
+
-
L R
t
e
u
L
L
L
(t)
(t)
(t)
t
e
u
M
M
M
(t)
(t)
(t)
-
G (s)
1
G (s)
3
1/n G (s)
2
K
B
V (s)
A
I (s)
A
T (s)
M
(s)
M
O
(s)
L
O
D(s)
116
Since V(s) =0
( )
( )
M T
B M
T s K
K s Ls R
=
O +
( ) ( )
M L
s n s O = O

( ) 1
( )
( )
L
T B L
E E
n s
K K n s
J s c
D s
Ls R
O
=
O
+

+
( )
( ) ( ) ( )
( )
T B L
L E E
K K n s Ls R D s
n s J s c
Ls R
O +
O + =
+


( )( ) ( ) ( ) ( )
E E T B L
n J s c Ls R nK K s Ls R D s + + + O = + (




( )
( )( )
( )
( )
( )
L
D
E E T B
Ls R
s
G s
D s n J s c Ls R K K
+
O
= =
+ + + (



Open-loop steady-state error for a step disturbance of magnitude D, ( )
D
D s
s
=

( )
( )( )
( ) ( ) ( ) ( ) ( )
OL LDES L L
E E T B
Ls R
E s s s s D s
n J s c Ls R K K
+
= O O = O =
+ + + (



( )
( )( )
| |
lim ( ) lim ( ) lim
0 0
ssOL OL OL
E E T B
ssOL
E T B
Ls R
D
e e t sE s s
t
s s s n J s c Ls R K K
RD
e
n RC K K
+
= = =

+ + + (

=
+



Closed-loop diagram with disturbance, tachometer, and P controller



where O
LDES
(s) is the desired load shaft angular velocity output, and the other terms have been
previously defined.

-
G (s)
1
G (s)
3
1/n G (s)
2
K
B
V (s)
A
I (s)
A
T (s)
M
(s)
M
O
(s)
L
O
D(s)
-
(s)
LDES
O
K
t
117
Let O
LDES
(s) =0 and check changes in O
L
(s) given a disturbance input. Since O
LDES
(s) =0, any
O
L
(s) is the steady-state error, that is, we wish as low an output as possible for the closed-loop system.

Derive the closed-loop disturbance transfer function
( )
( )
( )
L
D
LDES
s
T s
s
O
=
O
.

( ) 1
( ) ( )
M
M D E E
s
T s T s J s c
O
=
+

( )
( )
M T
T s K
A s Ls R
=
+
( ) ( )
M L
s n s O = O

( )
( )
( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
A B M
A CL LDES t L t L
t L B L t B L
A s V s K s
V s KE s K s K s KK s
A s KK s nK s KK nK s
= O
= = O O = O
= O O = + O


( ) ( )
( )
T t B L
M
K KK nK s
T s
Ls R
+ O
=
+


( )
( ) 1
( )
( )
L
T t B L E E
n s
K KK nK s J s c
D s
Ls R
O
=
+ O +

+


( )
( ) ( ) ( ) ( )
( )
T t B L
L E E
K KK nK s Ls R D s
n s J s c
Ls R
+ O +
O + =
+


( )( ) ( ) ( ) ( ) ( )
E E T t B L
n J s c Ls R K KK nK s Ls R D s ( + + + + O = +



( )
( )( ) ( )
( )
( )
( )
L
D
LDES E E T t B
Ls R
s
T s
s n J s c Ls R K KK nK
+
O
= =
O ( + + + +




Closed-loop steady-state error for a step disturbance of magnitude D, ( )
D
D s
s
=

( ) ( ) ( ) ( )
CL LDES L L
E s s s s = O O = O

( )
( )( ) ( )
( ) ( )
CL
E E T t B
Ls R
E s D s
n J s c Ls R K KK nK
+
=
( + + + +



lim ( ) lim ( )
0
ssCL CL CL
e e t sE s
t
s
= =




( )
( )( ) ( )
lim
0
ssCL
E E T t B
Ls R
D
e s
s s n J s c Ls R K KK nK
+
=
( + + + +


118

( )
ssCL
E T t B
RD
e
nRc K KK nK
=
+ +


For disturbance-rejecting controller design, ensure the closed-loop steady-state error is less than the
open-loop steady-state error.

( )
| |
| |
( )
E T B
ssCL
ssOL E T t B
E T B ssCL
ssOL E T t B
n Rc K K
e RD
e nRc K KK nK RD
n Rc K K e
e nRc K KK nK
+
=
+ +
+
=
+ +


Design so 1
ssCL
ssOL
e
e
<<


119
Numerical example from Term Example

| |
| |
10
200 1 100
10
20200
ssOL
E T B
RD
e
n Rc K K
D
D
=
+
=
+
=

( )
( )
10
200 100 200
10
20200 100
ssCL
E T t B
t
t
RD
e
nRc K KK nK
D
KK
D
KK
=
+ +
=
+ +
=
+



10 20200
20200 100 10
20200
20200 100
ssCL
ssOL t
t
e D
e KK D
KK
=
+
=
+

20200
1
20200 100
ssCL
ssOL t
e
e KK
= <
+



20200 100 20200
100 0
0
t
t
t
KK
KK
KK
+ >
>
>>



K
t
tachometer selection
K proportional controller gain


Assume the tachometer gain is fixed. Then the only way to reduce the closed-loop steady-state
error is to increase proportional controller gain K as much as possible.

Now, this proportional controller for disturbance rejection is not very satisfying we know from
the root-locus plot that the higher we make K, the worse the transient response will be (stable but more
highly underdamped as K increases). So this demonstrates another tradeoff in controller design to
ensure lower steady-state errors due to unknown, unwanted disturbances, we must accept worse
transient response performance.



120
6. Vibrational Responses

6.1 Free Vibrational Responses

6.1.1 Undamped Second-Order System Free Responses: Simple Harmonic Motion

6.1.1.1 Analytical Undamped Second-Order System Free ODE Solutions

Unforced Second-Order System Solution Validation

After one obtains the solution to an ODE, the next important step is to check the solution x(t) to
ensure it is correct. We now present two ways to validate the solution, the first partial and the second
complete.


First, we can check the initial conditions of the resulting solution to ensure they are correct. For
the initial position we substitute t =0 into the function x(t), and for the initial velocity we substitute t =0
into the function ( ) x t .

0
0
0
0
0
0
0
( ) cos sin
(0) cos[ (0)] sin[ (0)]
(0) (1) (0)
(0)
n n
n
n n
n
n
v
x t x t t
v
x x
v
x x
x x
e e
e
e e
e
e
= +
= +
= +
=

0
0
0 0
0 0
0 0
0
( ) sin cos
( ) sin cos
(0) sin[ (0)] cos[ (0)]
(0) (0) (1)
(0)
n n n n
n
n n n
n n n
n
v
x t x t t
x t x t v t
x x v
x x v
x v
e e e e
e
e e e
e e e
e
= +
= +
= +
= +
=



So we see both required initial conditions x
0
and v
0
are achieved by our solution x(t). This is a
weak check, since it only looks at t =0. A second, stronger solution check is to substitute x(t) and its
second derivative into the original ODE and ensure that an equality results. This is a complete check.
First, here are the displacement solution x(t) and its two time derivatives.

0
0
0 0
2
0 0
( ) cos sin
( ) sin cos
( ) cos sin
n n
n
n n n
n n n n
v
x t x t t
x t x t v t
x t x t v t
e e
e
e e e
e e e e
= +
= +
=



Now we substitute ( ), ( ) x t x t into the translational mechanical Harmonic Oscillator ODE and simplify,
using
n
k
m
e = .

121
2 0
0 0 0
2 0 0
0 0 0 0 0 0
0
0 0 0
2 0
0 0 0
( ) ( ) 0
[ cos sin ] [ cos sin ] 0
( )cos ( ) ( )cos ( ) 0
( )cos ( ) 0
( ) ( ) 0
(
n n n n n n
n
n n n n n
n n
n n
n
n n
n
mx t kx t
v
m x t v t k x t t
v v k
mx kx t mv k mx kx t mv k
m
v
kx kx t mv k
v
mv k mv kv
e e e e e e
e
e e e e e
e e
e e
e
e e
e
+ =
+ + =
+ + + = + + + =
+ + + =
+ = + =

0 0 0 0
) ( ) 0
0 0
k
mv kv kv kv
m
+ = + =
=

Since a valid equation results, i.e. 0 =0, this means the unique ODE solution is correct.

122
Analytical Solution via the Laplace Transform Method

Let us solve the same general unforced Harmonic Oscillator second-order IVP ODE using an
alternative method: Laplace Transforms. Since we are solving a linear ODE, there is a unique solution,
which we have found using the Slow ME Way and validated by direct substitution.

The Problem Statement is the same:

Solve
2 0
( ) ( ) 0 a x t a x t + = for x(t) given a
2
, a
0
, and values for the initial conditions:

0
0
(0)
(0)
x x
x v
=
=


In contrast to the Slow ME Way, ODE solution via Laplace Transforms is accomplished
algebraically in the Laplace frequency domain, in a single step, including the initial conditions.

The first step is to take the Laplace Transform of both sides of the ODE, including the initial
conditions, and solving algebraically for the unknown in the Laplace domain, ( ) { ( )} X s L x t = .

{ }
2 0
2
2 0
2
2 0 2 0 0
2 0 0
2
2 0
( ) ( ) 0
( ( ) (0) (0)) ( ) 0
( ) ( ) ( )
( )
( )
L a x t a x t
a s X s sx x a X s
a s a X s a x s v
a x s v
X s
a s a
+ =
+ =
+ = +
+
=
+



Note that the system characteristic polynomial
2
2 0
a s a + appears when using the Laplace
Transform method. To find the solution in the time domain, x(t), we must take the inverse Laplace
Transform of X(s).

{ }
1
1 1 2 0 0 0 0
2
2
0
2 0
2
1 1 1 1 0 0
0 0
2 2 2 2
0 0 0 0
2 2 2 2
( ) ( )
( )
( )
1
( )
x t L X s
a x s v x s v
x t L L
a
a s a
s
a
x s v s
x t L L x L v L
a a a a
s s s s
a a a a



=


+ +
= =
` `
+
)

+

)



= + = +
` ` ` `

+ + + +

) ) ) )


Consulting a table of Laplace Transforms, such as in Appendix B, we find two applicable entries.
2 2
sin t
s
e
e
e

+

2 2
cos
s
t
s
e
e

+

123

The left term in x(t) above is ready to go and will yield a cosine term; the right term must be
manipulated algebraically, multiplying by a 1 (
0 0
2 2
a a
a a
) and rearranging.

0
1 1 0 2
0
2 2 0 0 0
2 2 2
( )
a
v a s
x t x L L
a a a
s s
a a a




= +
` `

+ +

) )


Now let us use our earlier definition for natural frequency:

0
2
n
a
a
e =

to yield

2
1 1 0
0 2 2 2 2 2
( )
n
n n n
v s
x t x L L
s s
e
e e e


= +
` `
+ +
) )


With one more algebraic manipulation (distributing the product
2
n n n
e ee = )

1 1 0
0 2 2 2 2 2
1 1 0
0 2 2 2 2
( )
( )
n n
n n n
n
n n n
v s
x t x L L
s s
v s
x t x L L
s s
e e
e e e
e
e e e



= +
` `
+ +
) )

= +
` `
+ +
) )


We can finally take the two inverse Laplace Transforms to yield the solution x(t)

0
0
( ) cos sin
n n
n
v
x t x t t e e
e
= +

As predicted, this solution agrees with the solution derived via the Slow ME Way we have validated
this solution, presented some equivalent alternative solution forms, and presented a numerical example
so we neednt repeat this work since it is the same.


124
Analytical Solution via MATLAB dsolve

Let us solve the same general unforced Harmonic Oscillator second-order IVP ODE using
another alternative method: the MATLAB function dsolve. The Problem Statement is again the same:

Solve
2 0
( ) ( ) 0 a x t a x t + = for x(t) given a
2
, a
0
, and values for the initial conditions

0
0
(0)
(0)
x x
x v
=
=



The MATLAB code below, contained in VibesDsolve.m, shows how to analytically solve
this second-order IVP ODE using MATLAB function dsolve and display the analytical solution
results to the screen.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Anal yt i cal sol ut i on f or t he second- or der Har moni c Osci l l at or
% ODE usi ng symbol i c MATLAB f unct i on dsol ve.
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c;
cl ear ;

syms a0 a2 x0 v0; %decl ar e symbol i c var i abl es

x = dsol ve( a2*D2x+a0*x=0 , Dx( 0) =v0 , x( 0) =x0 ) ; %sol ve
pr et t y( x) %di spl ay


The dsolve result is
1/2
1/2 a0 t
v0 a2 sin(-------)
1/2 1/2
a2 a0 t
--------------------- + x0 cos(-------)
1/2 1/2
a0 a2

which is the same as our previous result
0
0
( ) cos sin
n n
n
v
x t x t t e e
e
= +

0
2
n
a
a
e =

Note MATLAB dsolve can also solve ODEs analytically given numerical parameter and initial
condition values.


125
6.1.1.4 Undamped Second-Order System Free Response Numerical Example

Given a translational mechanical Harmonic Oscillator, assuming frictionless motion and zero
applied input force, determine and plot the time response to the initial conditions.

Solve ( ) ( ) 0 mx t kx t + = for x(t)

Given m =10 kg, k =10t
2
N/m and initial conditions

0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Solution
This example is solved in MATLAB file SHM.m. From our earlier general second-order
solution, the natural frequency e
n
and SHM response x(t) are:
2
0
2
10 rad
10 sec
n
a k
a m
t
e t = = = =

( ) 0.01cos 0.0095sin x t t t t t = +

Also from earlier derivations, here are the two alternate SHM solutions:

( ) 0.0138cos( 0.7623) x t t t =


( ) 0.0138sin( 0.8084) x t t t = +

Note the two phase angles in the alternate solutions are separated by
2 1
2 rad 90 | | t = =

,
since the cosine function leads the sine function by 90

as stated earlier.

All three solution forms are mathematically-equivalent and their time response plot is shown
below. First we calculate the cyclical frequency f and its associated vibrational time period T.

0.5 Hz
2 2
n
f
e t
t t
= = =

1 1
2 sec
0.5
T
f
= = =

126


SHM Numerical Example x(t) Time Response

From the above time response we clearly see that the vibrational time period is 2 sec, as
calculated. This periodic response oscillates theoretically forever, neither damping down to zero, nor
increasing in magnitude. The sinusoidal wave oscillates symmetrically about the neutral spring location
x =0. At t =0, the initial value is 0.01 m as required; further, the slope is non-zero, it is +0.03 m/s as
specified in the problem input (one can zoom in and measure this on the plot). The amplitude of this
oscillatory vibration is A =0.0138 m, as calculated.

Physically this problem can be viewed as stretching the spring by 0.01 m to the right, and further
imparting an initial velocity of 0.03 m/s, also to the right. The ensuing motion plotted above is the SHM
response to these initial conditions. This homogeneous, or transient response, theoretically vibrates
forever since there is no friction (damping) in the model. In the real world we know that an input force
would be required to maintain such a SHM motion.


127
For a more complete graphical result in this numerical example, we next plot the same
displacement x(t) as above, along with its two derivatives.
0
0
0 0
2
0 0
( ) cos sin
( ) sin cos
( ) cos sin
n n
n
n n n
n n n n
v
x t x t t
x t x t v t
x t x t v t
e e
e
e e e
e e e e
= +
= +
=


( ) 0.0100cos 0.0095sin
( ) 0.0314sin 0.0300cos
( ) 0.0987cos 0.0942sin
x t t t
x t t t
x t t t
t t
t t
t t
= +
= +
=



We see below that all three curves have the same natural frequency e
n
=t rad/s and hence the same
vibrational time period T =2 sec. The velocity curve leads the position curve by t/2 rad (90

), and the
acceleration curve leads the velocity curve by t/2 rad (90

; so acceleration leads the position curve by


180

). In time units, the velocity curve leads the position curve by T/4 =0.5 sec, and the acceleration
curve leads the velocity curve by T/4 =0.5 sec (so acceleration leads the position curve by 1 sec).

SHM Numerical Example x(t) and Time Derivatives Time Response

The amplitudes of the position, velocity, and acceleration curves in this example (A
x
, A
v
, A
a
,
respectively) are given below. If e
n
is greater than 1, these amplitudes will increase with differentiation.
2
2 0
0 2
2 2
0 0
2 2 2 2
0 0
0.0138 m
( ) 0.0434 m/s
( ) ( ) 0.1365 m/s
x
n
v n
a n n
v
A x
A x v
A x v
e
e
e e
= + =
= + =
= + =



128
The shaking force for this SHM is plotted below. In shape it is identical to x(t) since
shake
( ) ( ) F t kx t = + ; since k =10t
2
N/m, the magnitude appears to be about 100x greater than that of x(t)
(k =98.7 N/m).



SHM Numerical Example Shaking Force


129
For this same numerical example, the potential, kinetic, and total mechanical energies are plotted
below, again by MATLAB file SHM.m. .


SHM Numerical Example Mechanical Energy

In this energy plot, the initial potential, kinetic, and total energies are:

| |
| |
2
2 2
2
2
1 1
(0) (0) 10 (0.01) 0.0049 Nm
2 2
1 1
(0) (0) 10(0.03) 0.0045 Nm
2 2
(0) (0) (0) 0.0049 0.0045 0.0094 Nm
V k x
T m v
E V T
t = = =
= = =
= + = + =



As seen in this plot and as derived earlier, this initial energy E(0) is the value of the total constant
energy throughout this SHM simulation.

2 2 2
2 2 2 2
1 1
10 (0.0138) 0.0094 Nm
2 2
1 1
10 (0.0138) 0.0094 Nm
2 2
n
E kA
E m A
t
e t
= = =
= = =


Note that the minimum potential and kinetic energies are zero so the energies are never negative.
Both curves are periodically-varying symmetrically about the half-energy value of 0.0047 Nm. Due to
the squaring (position in potential energy and velocity in kinetic energy), the sinusoidal curves for
potential and kinetic energies occur twice as fast. That is, the time period for the energy components is
130
half that of the position, velocity, and acceleration responses, 1 sec instead of 2. The energy
components circular and cyclical frequencies e and f are double the circular and cyclical frequencies e
and f of the displacement terms.

In the plot above we also see that when the kinetic energy is minimum (zero), the potential
energy is maximum (E) and vice versa. This makes sense because when the spring is fully stretched to
the maximum displacement A, the velocity is instantaneously zero. Conversely, when the potential
energy is zero (at the spring neutral length), the velocity is maximum.

In between the potential and kinetic energies are periodically equal to each other at the half-
energy value. This regularly occurs when:

2 2
mid
2 2
mid
mid
1 1
2 4 2
1
2
1
0.0098 m
2
E
kA kx
A x
x A
= =
=
= =

2 2 2
mid
2 2 2
mid
mid
1 1
2 4 2
1
2
1
0.0307 m/sec
2
n
n
n
E
m A mv
A v
v A
e
e
e
= =
=
= =


So we see that
mid mid n
v x e = in this special equal energies case. This condition first occurs at t =0.49 sec
and t =0.99 sec.



131
Let us now repeat this SHM numerical example, with all the same input conditions, except that
the initial velocity should be 0.03 m/s instead of +0.03 m/s.

Solution
The three SHM response solution forms are (the natural frequency is unchanged, t):

( ) 0.01cos 0.0095sin x t t t t t =

( ) 0.0138cos( 0.7623) x t t t = +


( ) 0.0138sin( 2.3331) x t t t = +

Again the two phase angles in the alternate solutions are separated by
2 1
2 rad 90 | | t = =

.
The cyclical frequency f and the time period T are both unchanged, 0.5 Hz and 2 sec, respectively. The
amplitude of vibration is also unchanged, A =0.0138 m.
Again all three solution forms are mathematically-equivalent and their new time response plot is
shown below.



SHM with Negative Initial Velocity

Again, this problem can be viewed as stretching the spring by 0.01 m to the right, and further
imparting an initial velocity of 0.03 m/s, this time to the left. We now see that the initial slope is
negative in the plot, as specified.

132
The following two plots (on the same axes), present the time responses for the same numerical
example, with initial condition x
0
=0.01 m only and, separately, initial condition v
0
=0.03 m/sec,
respectively.



Initial-Position-only and Initial-Velocity-only SHM


We see that the initial-position-only solution is a pure cosine wave starting at x
0
=0.01 m, with
flat slope initially (v
0
=0 m/sec). The initial-velocity-only solution is a pure sine wave with initial slope
v
0
=0.03 m/sec, and zero initial position (x
0
=0 m). Both distinct cases have the same time period of
vibration, T =2 sec as before, but different amplitudes. The initial-position-only solution amplitude is x
0

=0.01 m, and the initial-velocity-only solution amplitude is v
0
/ e
n
=0.0095 m. Clearly if we were
instead to choose negative initial values for the initial-position-only and initial-velocity-only solutions,
the results would be a negative cosine wave, and a negative sine wave, respectively.



133
Finally for this numerical example, we will compare similar initial-position only solution results
but for three systems of differing natural frequency; case 1 is identical to the numerical example and
cases 2 and 3 are new.

case k (N/m) m (kg) e
n
(rad/sec) f (Hz) T (sec)
1 10t
2
10
t
1 / 2 2
2 5t
2
/ 2 10 t / 2 1 / 4 4
3 10t
2
/ 9 10 t / 3 1 / 6 6




Initial-Position-only SHM Solutions with Different Time Periods


In the above graphs we can clearly see the time periods of T =2, 4, 6, for cases 1, 2, 3,
respectively. The solutions for all three cases are pure cosine waves starting at x
0
=0.01 m, with an
initial flat slope (v
0
=0 m/sec). Comparing the table above with the graphs above, we see that for
greater time periods T, the natural frequency e
n
must be lesser (they are inversely related, 2
n
T e t = ).
Also, assuming a constant mass m as in the three cases above, the spring constant k must decrease as e
n

decreases (they are directly related,
2
n
k me = ). That is, the time period T of vibration increases as the
spring k becomes softer.

The previous three plots were also generated by MATLAB file SHM.m.

134
6.1.1.5 Undamped Second-Order System ODE Free Response Numerical Solutions

SHM Animation in MATLAB
MATLAB can be used to demonstrate SHM for a given numerical example. Use
SHMAnimVert.m to demonstrate mass/spring motion, plus animated phase plots ( ( ) x t vs. x(t)),
animated x(t), ( ) x t , ( ) x t vs. t plots, the rotating phasor representation of the position, velocity, and
acceleration vectors, and the animated energy plots. Also use PendAnim.m for the linearized
pendulum SHM.
To communicate a dynamic system with MATLAB functions ode45, initial, or the
MATLAB GUI Simulink, we must introduce state-space representation of dynamic systems.

State-space matrices to represent a second-order ODE
For the general forced, damped second-order dynamic system:
2 1 0
( ) ( ) ( ) ( ) a x t a x t a x t u t + + = ,
where x(t) is the single output displacement and u(t) is the single input. First, define state vector X(t):



Substitute into the original equation:




The original single second-order ODE can be written as a system of two first-order ODEs.



And the output x(t) is called y(t) in standard state-space notation.



Write these equations in matrix-vector form to get the state-space description.

- State differential equations





- Output algebraic equation





In this example, the state vector is composed of the position and velocity of the output y(t) (originally
called x(t)). Two states are required since we started with one second-order ODE.

135
Numerical Solution via MATLAB ode45
Given the same translational mechanical Harmonic Oscillator from the previous numerical
example, find the solution numerically using MATLAB function ode45. This function implements the
fourth/fifth-order Runge-Kutta numerical solution for ODEs.

Solve ( ) ( ) 0 mx t kx t + = for x(t)

Given m =10 kg, k =10t
2
N/m and initial conditions:
0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Usage
[tout,yout] = ode45(odefun,tspan,Y0);
odefun is a function handle to the function containing the ODE right-hand-side.
Tspan = [t0 tfinal] is the time span
Y0 array of initial conditions on Y.

MATLAB function ode45 integrates the system of differential equations y = f(t,y) from time
t0 to tfinal with initial conditions Y0.

So we must first express the ODE in the MATLAB-accepted form y = f(t,y), i.e. convert
the single second-order ODE into two first-order ODEs. Define:
1
2 1
2 1
( ) ( )
( ) ( ) ( )
( ) ( ) ( )
x t x t
x t x t x t
x t x t x t
=
= =
= =



1 2
2 1
( ) ( )
( ) ( )
x t x t
k
x t x t
m
=
=



Here is MATLAB m-file OdeToE452.m to solve the unforced second-order ODE numerical example
using MATLAB function ode45.

clear; clc;
[t,x] = ode45(@secund,[0 6],[0.01 0.03]); % (fn name, t range, X0)
figure;
plot(t,x(:,1)); grid;

The function containing the ODE RHS is given below. This function secund.m must be in the
MATLAB search path.
function dx = secund(t,x)
m = 10; k = 10*pi^2;
dx = zeros(2,1); % a column vector
dx(1) = x(2);
dx(2) = -(k/m)*x(1);

The plot generated by this MATLAB m-file is identical to that presented earlier in the numerical
example, so it is not repeated here.

136
Numerical Solution via MATLAB function initial

Given the same translational mechanical Harmonic Oscillator from the previous numerical
examples, find the solution numerically using MATLAB function initial. This function solves
unforced IVP ODE problems numerically. MATLAB function initial only accepts state-space
matrices as inputs for your system, so we must first introduce this concept.

State-space matrices to represent the translational mechanical m-c-k system.

The general forced, damped translational mechanical m-c-k system model is recalled below.

( ) ( ) ( ) ( ) mx t cx t kx t f t + + =

where x(t) is the single output displacement and f(t) is the single input force. Define state vector X(t):


1
2
( )
( )
( )
x t
t
x t

=
`
)
X
1
2 1
( ) ( )
( ) ( ) ( )
x t x t
x t x t x t
=
= =
so
2
2
( ) ( )
( ) ( )
x t x t
x t x t
=
=




Substitute into the original equation

2 2 1
( ) ( ) ( ) ( ) mx t cx t kx t f t + + =

The original single second-order ODE can be written as a system of two first-order ODEs.

1 2
2 2 1
( ) ( )
1
( ) ( ) ( ) ( )
x t x t
c k
x t x t x t f t
m m m
=
= +



And the output is generally called y(t).
1
( ) ( ) ( ) y t x t x t = =

Write these equations in matrix-vector form to get the state-space description
* State differential equations
{ }
1 1
2 2
0 1 0
( ) ( )
( )
1
( ) ( )
x t x t
f t
k c
x t x t
m m m
( (

( (
= +
` `
( (

) )


* Output algebraic equation
{ } | | | |{ }
1
2
( )
( ) 1 0 0 ( )
( )
x t
y t f t
x t

= +
`
)


In this example, the state vector is composed of the position and velocity of the output y(t) (originally
called x(t)). Two states are required since we started with one second-order ODE.


137
General Form of State-Space Equations

m number of inputs (m =1 in this example)
p number of outputs (p =1 in this example)
n number of state variables (the order of the ODE, n =2 in this example)

- State differential equations matrix of first-order ODEs ( ) ( ) ( ) t t t X = AX +BU


A n x n system dynamics matrix
X n x 1 state vector
B n x m input matrix
U m x 1 input vector

* Output equations matrix of algebraic equations ( ) ( ) ( ) t t t Y = CX + DU
Y p x 1 output vector
C p x n output matrix
D p x m direct transmission matrix

| |
= D 0 for most physical systems because dynamics appear in all paths from input to output.

For the second-order m-c-k system, m =p =1, n =2

0 1
k c
m m
(
(
=
(


A
0
1
m
(
(
=
(

B
| |
1 0 = C
| |
0 = D


The current problem is undamped so c =0 and unforced so f(t) =0. We will set c to 0 in the A
matrix, but we will not set matrix B to zero since MATLAB function initial assumes zero input
forcing.

Back to the problem at hand

Solve ( ) ( ) 0 mx t kx t + = for x(t), using MATLAB function initial

Given m =10 kg, k =10t
2
N/m and initial conditions:

0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


[y,t,x] = initial(SysName,X0); Initial condition response of state-space models.
Y output vector
t time array chosen by MATLAB
x resulting state vector
SysName system model composed of A, B, C, D
X0 vector of initial conditions

138
Here is some MATLAB code contained in SHM.m to solve the SHM numerical example using
MATLAB function initial.

clear; clc;
m = 10; c = 0; k = 10*pi^2;
A = [0 1;-k/m -c/m]; % define ABCD state-space matrices
B = [0; 1/m];
C = [1 0];
D = [0];
mck = ss(A,B,C,D); % define a state-space model in MATLAB
X0 = [0.01;0.03]; % given initial conditions
[y,t,x] = initial(mck,X0); % solve the IVP numerically

figure;
plot(t,y); grid; axis([0 6 -0.015 0.015]);
set(gca,FontSize,18);
xlabel({\ittime} ({\itsec}));
ylabel({\itx(t)} ({\itm}));


The plot generated by this MATLAB m-file is identical to that presented earlier in the numerical
example, so it is not repeated here.


139
Numerical Solution via MATLAB / Simulink

We can solve the free response to initial conditions for the same undamped second-order ODE
(yielding Simple Harmonic Motion) using MATLABs GUI Simulink. From the MATLAB command
window type simulink and you can create and simulate any dynamic system described by ODEs,
including vibratory systems. J ust like MATLAB function initial, we can enter a dynamic system
into Simulink via the state-space matrices given previously for this example.

The Simulink diagram below, SHMFree.mdl, was created to solve this same second-order
SHM free time response to the initial conditions. As shown, the input is a constant zero (free response)
and the output is plotted on a scope.


Simulink Model to Solve undamped SHM Second-Order ODE Free Response

We double-clicked the State-Space block (see graphic below) to enter the (scalar) matrices
ABCD from the previous numerical example using MATLAB function initial. This is also the place
to enter the initial conditions x(0) =0.01 and (0) 0.03 x = . We entered 6.0 in the final time dialog
window at the top and then just pressed the play button. Double-clicking on the scope then displayed
the simulation results. The resulting plot is identical to that shown previously for the SHM numerical
example (though the Simulink graphics do not look as nice); see the Simulink plot scope on the
following page.



140


Simulink Scope Plot for Undamped SHM Second-Order ODE Free Responses


141
6.1.2 Damped Second-Order System Free Responses

6.1.2.1 Analytical Underdamped Second-Order System Free Response ODE Solutions

Underdamped Second-Order System Free Response Solution Validation

After one obtains the solution to an ODE, the next important step is to check the solution x(t) to
ensure it is correct. We now present two ways to validate the solution, the first partial and the second
complete.

First, we can check the initial conditions of the resulting solution to ensure they are correct. For
the initial position we substitute t =0 into the function x(t), and for the initial velocity we substitute t =0
into the function ( ) x t .

0 0
0
(0) 0 0
0
0 0
0
0
( ) cos sin
(0) cos(0) sin(0)
(0) (1) (1) (0)
(0)
n
t n
d d
d
n
d
n
d
x v
x t e x t t
x v
x e x
x v
x x
x x
e
e
e e
e
e
e
e
e

( +
= +
(

( +
= +
(

( +
= +
(

=

| |
| |
1 2 1 2
(0)
1 2 1 2
1 2 1 2
0 0
0 0 0 0
0
( ) ( )cos ( )sin
(0) ( )cos(0) ( )sin(0)
(0) ( )(1) ( )(0)
(0)
(0)
n
t
n d d d n d
n d d n
n d d n
n
n d n n
d
x t e C C t C C t
x e C C C C
x C C C C
x v
x x x x v
x v
e
e e e e e e
e e e e
e e e e
e
e e e e
e

= + +
= + +
= + +
+
= + = + +
=



So we see both required initial conditions x
0
and v
0
are achieved by our solution x(t). This is a
weak check, since it only looks at t =0. A second, stronger solution check is to substitute x(t) and its
first and second derivatives into the original ODE and ensure that an equality results. This is a complete
check. First, since we have the general displacement solution x(t) and its first derivative ( ) x t , we must
take another time derivative to find ( ) x t :

| |
| |
| |
| |
1 2
1 2 1 2
1 2 1 2
1 2 1 2
( ) cos sin
( ) ( )cos ( )sin
( ) ( )cos ( )sin
( )sin ( )cos
n
n
n
n
t
d d
t
n d d d n d
t
n n d d d n d
t
d n d d d d n d
x t e C t C t
x t e C C t C C t
x t e C C t C C t
e C C t C C t
e
e
e
e
e e
e e e e e e
e e e e e e e
e e e e e e e e

= +
= + +
= + +
+ + +



Simplifying ( ) x t

142
| |
| |
| |
| |
1 2 1 2
1 2 1 2
1 2 1 2
1 2 1 2
( )cos ( )sin
( )
( )sin ( )cos
( ) ( ) cos
( )
( ) ( ) sin
n
n
n n d d d n d
t
d n d d d d n d
n n d d d n d
t
n d n d n d
C C t C C t
x t e
C C t C C t
C C C C t
x t e
C C C C
e
e
e e e e e e e
e e e e e e e e
e e e e e e e
e e e e e e

+ +

=
`
+ + +

)
+ +
=
+ +

| |
| |
1 2 1 2
1 2 1 2
( ) ( ) cos
( )
( ) ( ) sin
n
d
n n d d d n d
t
n d n d n d d
t
C C C C t
x t e
C C C C t
e
e
e e e e e e e
e e e e e e e



`

)
+

=
`
+ + +

)



Now we substitute ( ), ( ), ( ) x t x t x t into the generic Damped Oscillator ODE and simplify.
| |
| |
| | | |
2
1 2 1 2
1 2 1 2
2
1 2 1 2 1 2
1
( ) 2 ( ) ( ) 0
( ) ( ) cos
( ) ( ) sin
2 ( )cos ( )sin cos sin 0
(
n
n n
n n
n n d d d n d
t
n d n d n d d
t t
n n d d d n d n d d
n
x t x t x t
C C C C t
e
C C C C t
e C C t C C t e C t C t
C
e
e e
e e
e e e e e e e
e e e e e e e
e e e e e e e e e e
e


+ + =
+

`
+ + +

)
+ + + + + =

| |
| |
| | | |
2 1 2
1 2 1 2
2
1 2 1 2 1 2
2
1 2 1 2 1 2 1
) ( ) cos
( ) ( ) sin
2 ( )cos ( )sin cos sin 0
( ) ( ) 2 ( )
n d d d n d
n d n d n d d
n n d d d n d n d d
n n d d d n n n d n
C C C t
C C C C t
C C t C C t C t C t
C C C C C C C
e e e e e e
e e e e e e e
e e e e e e e e e e
e e e e e e e e e e
+

`
+ + +

)
+ + + + + =
+ + + +

2
1 2 1 2 1 2 2
2 2 2 2 2 2
1 2 1 2 1 2 1
2 2 2 2 2 2
1 2 1 2 1 2 2
cos
( ) ( ) 2 ( ) sin 0
2 2 cos
2 2 sin
d
n d n d n d n d n n d
n n d d n d n n d n d
n d n n d d n d n n
t
C C C C C C C t
C C C C C C C t
C C C C C C C
e
e e e e e e e e e e e
e e e e e e e e e e e
e e e e e e e e e e e
(

( + + + + + =

( + +

( + + + +

2 2 2 2 2 2
1 2
2 2 2 2 2 2
1 2
2 2 2 2 2 2 2 2
1 2
1 2
0
( 2 ) ( 2 ) cos
( 2 ) ( 2 ) sin 0
( ) cos ( ) sin 0
(0) cos (0) sin 0
0
d
n d n n n d n d n d d
n d n d n d n d n n d
d n n d d n n d
d d
t
C C t
C C t
C t C t
C t C t
e e e e e e e e e e e
e e e e e e e e e e e
e e e e e e e e
e e
=
( + + +

( + + + + =

+ + + =
+ =
= 0


Since a valid equation results, i.e. 0 =0, this means the unique ODE solution is correct.

143
Free Damped Oscillator Shaking Forces

After the damped ODE solution x(t) is complete, we can calculate the shaking force for the free
damped cases. Shaking force is defined as the force that impacts the ground link due to the system
dynamics. Redrawing the m-c-k translational mechanical system FBD to include the ground link, we see
that the shaking force has another term due to the damping force, compared to the undamped case.



1-dof Translational Mechanical System Free-Body Diagram with Ground Link

The general shaking force for the second-order translational mechanical Damped Oscillator is:
shake S
( ) ( ) ( ) ( ) F t f t kx t cx t = = + +

Shaking force for the underdamped second-order translational mechanical Damped Oscillator:
shake
0 0
0
0 0 0 0
0 0
( ) ( ) ( )
cos sin
( )cos ( )sin
n
n
t n
d d
d
t n n
n d d d n d
d d
F t kx t cx t
x v
k e x t t
x v x v
c e x t x t
e
e
e
e e
e
e e
e e e e e e
e e

= + +
| | ( +
= +
|
(
|
\ .
| | ( + +
+ + +
|
(
|
\ .



Shaking force for the critically-damped second-order translational mechanical Damped Oscillator:
( ) ( )
shake
0 0 0 0 0 0 0 0
( ) ( ) ( )
( ) ( ) ( )
n n n n n
t t t t t
n n n n n
F t kx t cx t
k x e x v te c x e x v e x v te
e e e e e
e e e e e

= + +
= + + + + + +



Shaking force for the overdamped second-order translational mechanical Damped Oscillator:
1 2 1 2
shake
2 0 0 1 0 0 2 0 0 1 0 0
1 2
2 1 2 1 2 1 2 1
( ) ( ) ( )
s t s t s t s t
F t kx t cx t
s x v s x v s x v s x v
k e e c s e s e
s s s s s s s s
= + +
| | | | | | | | | | | | + +
= + + +
| | | | | |
| |

\ . \ . \ . \ . \ . \ .



The shaking force for the undamped case was presented earlier.


144
Unforced Second-Order System Analytical Solutions via MATLAB dsolve

As mentioned earlier, MATLAB dsolve can also solve IVP ODEs analytically given
numerical parameter and numerical initial condition values. We will demonstrate this now using the
same four damping cases from the numerical example.

Solve ( ) ( ) ( ) 0 mx t cx t kx t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m and initial conditions:

0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

The MATLAB code below, contained in VibesDsolve.m, shows how to analytically solve
these second-order IVP ODEs using MATLAB function dsolve and display the analytical solution
results to the screen.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Anal yt i cal sol ut i on f or t he second- or der Damped Osci l l at or
% ODE usi ng MATLAB f unct i on dsol ve wi t h numer i cal par amet er s.
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c; cl ear ;

xa = dsol ve( 10*D2x+98. 696*x=0 , Dx( 0) =0. 03 , x( 0) =0. 01 ) ; %sol ve
xb = dsol ve( 10*D2x+18. 85*Dx+98. 696*x=0 , Dx( 0) =0. 03 , x( 0) =0. 01 ) ;
xc = dsol ve( 10*D2x+20*pi *Dx+10*pi ^2*x=0 , Dx( 0) =0. 03 , x( 0) =0. 01 ) ;
xd = dsol ve( 10*D2x+125. 66*Dx+98. 696*x=0 , Dx( 0) =0. 03 , x( 0) =0. 01 ) ;

XA = vpa( xa, 4) ; %4 di gi t s
XB = vpa( xb, 4) ;
XC = vpa( xc, 4) ;
XD = vpa( xd, 4) ;

pr et t y( XA) %di spl ay
pr et t y( XB)
pr et t y( XC)
pr et t y( XD)


145
The four dsolve results are given below, compared with known solutions given earlier.

a.
0. 009547 si n( 3. 141 t ) + 0. 01000 cos( 3. 141 t )
a. Undamped Solution 0 =

( ) 0.01cos 0.0095sin x t t t t t = +

b.
0. 01316 exp( - 0. 9425 t ) si n( 2. 997 t ) + 0. 01000 exp( - 0. 9425 t )
cos( 2. 997 t )


b. Underdamped Solution 0 1 < <

| |
0.94
( ) 0.01cos3 0.0132sin3
t
x t e t t

= +

c.
0. 01000 exp( - 3. 142 t ) + 0. 06142 exp( - 3. 142 t ) t

c. Critically-damped Solution 1 =

( ) 0.01 0.0614
t t
x t e te
t t
= +

d.
0. 01353 exp( - 0. 8410 t ) 0. 003533 exp( - 11. 72 t )

d. Overdamped Solution 1 >

0.84 11.72
( ) 0.0135 0.0035
t t
x t e e

=


We see that all four dsolve results above are equivalent to their respective known solutions.

146
6.1.2.2 Damped Second-Order System Free Response Numerical Examples

Given a translational mechanical Damped Oscillator, assuming zero applied input force,
determine and plot the time response to the given initial conditions, for four given damping values c.
This problem is solved in DO.m.

Solve ( ) ( ) ( ) 0 mx t cx t kx t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m and initial conditions:
0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

Solution
For all four cases, the natural frequency e
n
is:
2
0
2
10 rad
10 sec
n
a k
a m
t
e t = = = =


a. Undamped Solution 0 =

this is identical to the SHM Example presented earlier.
Characteristic polynomial
2 2
s t +

roots i t

( ) 0.01cos 0.0095sin x t t t t t = +

0.5 Hz
2 2
n
f
e t
t t
= = =

1 1
2 sec
0.5
T
f
= = =


b. Underdamped Solution 0 1 < <
characteristic polynomial
2 2
1.89 s s t + +

roots 0.94 3i

2
18.85
0.3
2
2 100
c
km

t
= = =

2 2
1 1 0.3 3.00 rad/sec
d n
e e t = = =


| |
0.94
( ) 0.01cos3.00 0.0132sin3.00
t
x t e t t

= +

3.00
0.48 Hz
2 2
d
d
f
e
t t
= = =

1 1
2.09 sec
0.48
d
d
T
f
= = =

147
c. Critically-damped Solution 1 =
characteristic polynomial
2 2
2 s s t t + +

roots , t t

2
62.83
1
2
2 100
c
km

t
= = =

( ) 0.01 0.0614
t t
x t e te
t t
= +


d. Overdamped Solution 1 >
characteristic polynomial
2 2
12.57 s s t + +

roots 0.84, 11.73

2
125.66
2
2
2 100
c
km

t
= = =

0.84 11.72
( ) 0.0135 0.0035
t t
x t e e

=




Damped Oscillator Numerical Example x(t) Time Responses

The plot above shows the x(t) time responses for the four cases in this numerical example,
undamped ( 0 = ), underdamped (0 1 < < ), critically-damped ( 1 = ), and overdamped ( 1 > ).
Physically this problem can be viewed as stretching the spring by 0.01 m to the right, and further
imparting an initial velocity of 0.03 m/s, also to the right, in all four cases. We see that all four curves
148
start at the given initial position x
0
=0.01 m, with the given initial velocity (slope) v
0
=0.01 m/sec. We
see that only the undamped and underdamped cases exhibit vibratory motion, the oscillations caused by
the sin and cos components in their solutions. The critically-damped and overdamped cases do no
oscillate, but approach the final value of zero exponentially after the initial conditions. Further we see
that as the damping coefficient c increases (for the undamped, underdamped, critically-damped, and
overdamped cases), less and less motion is allowed.

The undamped case ( 0 = ) characteristic polynomial roots are complex conjugates with zero
real part so there is oscillation but no damping envelope. The time response exhibits Simple Harmonic
Motion, never damping out but oscillating about zero forever, which is impossible in free response in the
real world (there is always some friction).

The underdamped case (0 1 < < ) characteristic polynomial roots are complex conjugates with
negative real part so there is oscillation within a damping envelope. The time response overshoots and
undershoots the final value of zero, with a constantly-decreasing amplitude of vibration.

The critically-damped case ( 1 = ) characteristic polynomial roots are real, negative, and
identical. There is no oscillation. The time response to zero is the fastest possible without overshooting
and vibrating.

The overdamped case ( 1 > ) characteristic polynomial roots are real, negative, and distinct.
Again, there is no oscillation. The time response to zero is the slower than the critically-damped case.


The table below summarizes the characteristics of the undamped, underdamped, critically-
damped, and overdamped cases in this numerical example. It is very important for the student to learn
these without the need of solving ODEs and without the aid of MATLAB.


Case c (N-sec/m) roots e
n
e
d
a. undamped 0 0 i t t t
b. underdamped 18.85 0.3 0.94 3i t 3.00
c. critically-damped 62.83 1
, t t
t NA
d. overdamped 125.66 2
0.84, 11.73
t NA


149
Phase Portrait Plots
Another method to display vibrational results is phase portrait plots, where velocity v(t) is
plotted vs. position x(t). The graphs below, generated by DO.m, present the phase portraits for the
undamped, underdamped, critically-damped, and overdamped cases.


Damped Oscillator Numerical Example v(t) vs. x(t) Phase Portraits

Note in these plots time is implied, i.e. time elapses from the initial conditions (0.01 m, 0.03 m/sec) to
the final position/velocity values (0,0), as we can demonstrate on the plot above. For the undamped
case, there are no final position/velocity values, rather the phase portrait shown is in perpetual motion.
All four cases start at the given initial conditions (0.01 m, 0.03 m/sec) and proceed in a
clockwise direction as time increases. The underdamped, critically-damped, and overdamped cases end
(as time approaches infinity) at the origin (0,0). The underdamped case spirals in to this final value due
to its vibratory oscillations.
150
Underdamped Case

Now let us expand this numerical example to focus on the underdamped case. The plot below
shows five free vibrational time responses for the same exact conditions as this numerical example, with
five different underdamped c values, for comparison purposes.

1. c = 6.28 N-sec/m
2. c = 18.85 N-sec/m
3. c = 31.42 N-sec/m
4. c = 43.98 N-sec/m.
5. c = 56.55 N-sec/m.

All five of these cases have characteristic polynomial roots that are complex conjugates with
negative real part so oscillation within a damping envelope results. We see in the free time responses
below that all five cases exhibit the underdamped property of overshoot and undershoot while damping
to the final value of zero, with a constantly-decreasing amplitude of vibration. Again the initial
conditions, both position and velocity (slope) are evident. The damped natural frequency decreases as
increases, as expected. Therefore, the period of damped vibration increases as increases.



Underdamped Oscillator with Various Values

The table below summarizes the characteristics of the above five underdamped cases, for ease of
comparison. As the damping increases we see that the real part
n
e

of the roots increases (larger
negative values) while the imaginary part
d
i e of the roots decreases.
151

Case c (N-sec/m) roots e
n
e
d
1. 6.28 0.1 0.31 3.13i t 3.13
2. 18.85 0.3 0.94 3.00i t 3.00
3. 31.42 0.5 1.57 2.72i t 2.72
4. 43.98 0.7 2.20 2.24i t 2.24
5. 56.55 0.9 2.83 1.37i t 1.37


The shaking forces for these Damped Oscillators are plotted below. The undamped result is
identical to that presented earlier, but the shaking forces for the underdamped, critically-damped, and
overdamped cases are new.


Damped Oscillator Numerical Example x(t) Shaking Forces

152
This plot is much more interesting than the shaking force for SHM (undamped, which is repeated
above, which is just an amplification of the response x(t) by k). Due to the effect of the increasing
damping coefficients, the initial shaking force increases more and more for the underdamped, critically-
damped, and overdamped cases, respectively. But the higher the damping, the faster the shaking force
approaches zero as time elapses.

The plot below shows the total energy for the four damping cases in this numerical example.



Damped Oscillator Numerical Example Mechanical Energy

All four cases start with the same total energy since they have the same initial conditions, the
same mass and spring constant. The undamped cases, shown earlier, maintains constant energy since
there is no damping in this SHM model. In the underdamped, critically-damped, and overdamped cases,
the total energy goes to zero over time in the manner shown above. Due to damping, these latter three
cases no longer have constant total energy, which is more realistic that the SHM case.

The previous three plots were generated by DO.m.


153
6.1.2.3 Damped Second-Order System Free Response Numerical ODE Solutions

Numerical Solution via MATLAB ode45
Given the same translational mechanical Damped Oscillators from the previous numerical
examples, find the solution numerically using MATLAB function ode45. This function implements
the fourth/fifth-order Runge-Kutta numerical solution for ODEs.

Solve ( ) ( ) ( ) 0 mx t cx t kx t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m and initial conditions
0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

Usage
[tout,yout] = ode45(odefun,tspan,Y0);
odefun is a function handle to the function containing the ODE right-hand-side.
Tspan = [t0 tfinal] is the time span
Y0 array of initial conditions on Y.

MATLAB function ode45 integrates the system of differential equations y = f(t,y) from time
t0 to tfinal with initial conditions Y0.

So we must first express the ODE in the MATLAB-accepted form y = f(t,y), i.e. convert
the single second-order ODE into two first-order ODEs. Define:
1
2 1
2 1
( ) ( )
( ) ( ) ( )
( ) ( ) ( )
x t x t
x t x t x t
x t x t x t
=
= =
= =



1 2
2 1 2
( ) ( )
( ) ( ) ( )
x t x t
k c
x t x t x t
m m
=
=



Here is MATLAB m-file ODEToE452.m to solve the unforced second-order ODE numerical example
using MATLAB function ode45.

clear; clc;
[t,x] = ode45(@secund,[0 6],[0.01 0.03]); % (fn name, t range, X0)
figure;
plot(t,x(:,1)); grid;


154
The function containing the ODE RHS is given below. This function secund.m must be in the
MATLAB search path.

function dx = secund(t,x)
m = 10; c = 18.85; k = 10*pi^2;
dx = zeros(2,1); % a column vector
dx(1) = x(2);
dx(2) = -(k/m)*x(1) (c/m)*x(2);


The plots generated by this MATLAB m-file, by setting the proper values of c for the undamped,
underdamped, critically-damped, and undamped cases given, are identical to those presented earlier in
the numerical example, so they are not repeated here.

155
Numerical Solution via MATLAB function initial
Given the same translational mechanical Damped Oscillator from the previous numerical
examples, find the solution numerically using MATLAB function initial. The state-space matrices
for this system were previously derived:

0 1
k c
m m
(
(
=
(


A
0
1
m
(
(
=
(

B
| |
1 0 = C
| |
0 = D

Given a translational mechanical Damped Oscillator, assuming zero applied input force,
determine and plot the time response to the given initial conditions, for four given damping values c.

Solve ( ) ( ) ( ) 0 mx t cx t kx t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m and initial conditions

0
0
(0) 0.01 m
(0) 0.03 m/s
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

Here is a MATLAB m-file to solve the SHM numerical example using MATLAB function initial.

clc; clear;
m = 10; k = 10*pi^2; ca = 0; cb = 18.85; cc = 62.83; cd = 125.66;
% state space for use with MATLAB function initial
X0 = [0.01;0.03]; % given initial conditions
B = [0; 1/m]; C = [1 0]; D = [0]; % common BCD matrices
% define undamped state-space model and solve IVP
Aa = [0 1;-k/m ca/m]; mcka = ss(Aa,B,C,D); [ya,ta,xa] = initial(mcka,X0);
% define underdamped state-space model and solve IVP
Ab = [0 1;-k/m cb/m]; mckb = ss(Ab,B,C,D); [yb,tb,xb] = initial(mckb,X0);
% define critically-damped state-space model and solve IVP
Ac = [0 1;-k/m cc/m]; mckc = ss(Ac,B,C,D); [yc,tc,xc] = initial(mckc,X0);
% define overdamped state-space model and solve IVP
Ad = [0 1;-k/m cd/m]; mckd = ss(Ad,B,C,D); [yd,td,xd] = initial(mckd,X0);

figure;
plot(ta,ya,k,tb,yb,r,tc,yc,g,td,yd,b); grid; axis([0 6 -0.015 0.015]);
set(gca,FontSize,18);
legend(undamped,underdamped,critically-damped,overdamped);
xlabel({\ittime} ({\itsec})); ylabel({\itx(t)} from initial ({\itm}));

The plot generated by this MATLAB m-file, contained in DO.m, is identical to that presented earlier in
the numerical example, so it is not repeated here.

156
Numerical Solution via MATLAB / Simulink

We can solve the free response to initial conditions for the same series of second-order ODEs
(undamped, underdamped, critically-damped, and overdamped) using MATLABs GUI Simulink.
From the MATLAB command window type simulink and you can create and simulate any dynamic
system described by ODEs, including vibratory systems. J ust like MATLAB function i ni t i al , we
can enter a dynamic system into Simulink via the state-space matrices given previously for this series of
examples.

The Simulink diagram below, SecondFree.mdl, was created to solve this same series of
second-order free time responses to the initial conditions. As shown, all four second-order systems
(differing only in the amount of damping) can be fed by the same input. Then all four time responses
can be plotted on the same scope for ease of comparison, using a multiplexer and double-clicking to
change the default number of signals from two to four.


Simulink Model to Solve Second-Order ODE Free Responses

We used a constant input and double-clicked on it to enter 0 input (for a free response). We
double-clicked the State-Space block to enter the (scalar) matrices ABCD from the previous numerical
example using MATLAB function initial. Once you enter one valid set of ABCD, the remaining
cases may be entered quickly by copying the first block and double-clicking to enter the appropriate
damping value. This is also the place to enter the initial conditions x(0) =0.01 and (0) 0.03 x = . We
entered 6.0 in the final time dialog window at the top and then just pressed the play button. Double-
clicking on the scope will then display the simulation results. The resulting plots are identical to those
shown previously for the four damping cases (though the Simulink graphics do not look as nice); see the
Simulink plot scope on the following page.


157


Simulink Scope Plots for Second-Order ODE Free Responses:
Undamped, Underdamped, Critically-Damped, and Overdamped



158
Numerical Plots with All Three Derivatives

For a more complete graphical result in this numerical example, we next separately plot on the
next four graphs, the same displacements x(t) as above, along with two derivatives. The first one, for
undamped free SHM using MATLAB file SHM.m, has been presented previously.

( ) 0.0100cos 0.0095sin
( ) 0.0314sin 0.0300cos
( ) 0.0987cos 0.0942sin
x t t t
x t t t
x t t t
t t
t t
t t
= +
= +
=




Undamped SHM Numerical Example x(t) and Time Derivatives Time Response

159

Underdamped SHM Numerical Example x(t) and Time Derivatives Time Response


Critically-damped SHM Numerical Example x(t) and Time Derivatives Time Response
160

Overdamped SHM Numerical Example x(t) and Time Derivatives Time Response


Note that if e
n
>1 then the magnitude of the acceleration is greater than the magnitude of the velocity,
which is greater than the magnitude of the position, in all four cases.

The previous three plots were generated by MATLAB file DO.m.


161
6.2 Forced Vibrational Responses

This section presents forced vibrational responses for undamped and damped second-order
systems. Forced vibrational response indicates that an externally-applied oscillating input forcing
function is included, in addition to the initial conditions.

We will consider periodic harmonic input forcing functions of the form:

( ) sin f t F t e =

where F is the forcing function amplitude (N) and e is the harmonic forcing circular frequency
(rad/sec), called the driving frequency. Note we can use ( ) sin t t t e = T for systems with torque input.
We can also use similar harmonic forcing functions for voltage, current, displacement, and other
physical inputs. We will call the generic input u(t). Note that driving frequency e is not the same as
natural frequency e
n
(what happens if
n
e e ? Stay tuned.)

Now, many vibrations textbooks use ( ) cos f t F t e = instead of our choice using the sine
function. The solution results will be very similar, basically involving a different phase angle for the
steady-state vibrational responses. However, I say the sine choice is a better, more natural one why?

Notice that we do not include a phase angle in the harmonic forcing function above. We could
easily include one that will not change the solution method or complexity. However, since the engineer
has control over the input, we choose to ignore the phase angle.

In this section we will solve all forced ODEs with zero initial conditions. Including non-zero
initial conditions is possible if necessary and this will not change the solution method or complexity.
Section 6.1 presented free vibrational response subject to zero forcing function input and non-zero initial
conditions. This led to transient vibrational response. In this section with harmonic forcing functions
and zero initial conditions, there is a transient response due to the forcing function, in addition to steady-
state response also due to the forcing function.

6.2.1 Undamped Second-Order System Harmonically-Forced Responses

This section presents the IVP ODE solution for harmonically-forced undamped second-order
systems. We start with the free-response Harmonic Oscillators from Section 6.1, but add an input
forcing function ( ) sin f t F t e = .

The vibratory motion we will find is the linear superposition of the forced solution at the driving
frequency e and the free solution at the natural frequency e
n
.

6.2.1.1 Analytical Undamped Second-Order Harmonically-Forced ODE Solutions

We have seen earlier that different physical system models will lead to the same undamped
externally-forced second-order ODE form.

162







( ) ( ) ( ) mx t kx t f t + = ( ) ( ) ( )
R
J t k t t u u t + =

( ) ( ) ( )
g
t t t
L
u u t + =



The general second-order forced Harmonic Oscillator ODE form can be stated as:

2 0
( ) ( ) ( ) a x t a x t u t + =

In this section we will solve this harmonically-forced second-order ODE subject to
( ) sin u t U t e = and zero initial conditions and demonstrate the basic second-order system motion that
results. Again, U is the forcing function amplitude and e is the harmonic forcing circular frequency
(rad/sec), the driving frequency. All forced, undamped second-order systems presented in ME 3011
modeling, and others, can be solved in the same manner as presented here, substituting the appropriate
parameters and values in each case.

Problem Statement

Solve
2 0
( ) ( ) ( ) a x t a x t u t + = for x(t) given a
2
, a
0
, ( ) sin u t U t e = , and zero initial conditions

0
0
(0) 0
(0) 0
x x
x v
= =
= =


This is the forced initial value problem (IVP) from ordinary differential equations.

Analytical Solution via the Slow ME Way

Taking advantage of linear superposition, the total solution x(t) is the sum of the homogeneous
solution x
H
(t) plus the particular solution x
P
(t). The homogeneous solution is the transient response to
the initial conditions and the particular solution is the steady-state response to the external input. There
is also a transient response due to the input forcing function.

1. Homogeneous Solution. The homogeneous solution x
H
(t) is the solution to the unforced
ODE
2 0
( ) ( ) 0
H H
a x t a x t + = and was presented in Section 3.2.1 (we used coefficients C
i
in Section
3.2.1, but use B
i
here to avoid confusion with the ensuing particular solution):

1 2
( ) cos sin
H n n
x t B t B t e e = +

where
0
2
n
a
a
e =


x(t)
m
k
f(t)
J
k
(t)
R
u
(t) t
m
u
L
g
(t)
t(t)
163
The unknown homogeneous solution coefficients B
1
and B
2
must remain unknown for now. They will
be found later, by applying the initial conditions to the total solution, after the Particular Solution is
found.

2. Particular Solution. The particular solution x
P
(t) is the solution to the forced ODE:

2 0
( ) ( ) sin
P P
a x t a x t U t e + =

and is new in this section. We assume a particular solution form consistent with the form of the
harmonic forcing function ( ) sin u t U t e = .
1 2
( ) sin cos
P
x t C t C t e e = +

That is, for the harmonic forcing case with a sine function input and zero phase angle, the particular
solution must allow a non-zero phase angle, expressed above by including a cosine function along with
the sine function. Note that the frequency of the assumed particular solution (both sine and cosine) must
be identical to the driving circular frequency e.

The assumed particular solution form and its first two derivatives are:

1 2
1 2
2 2
1 2
( ) sin cos
( ) cos sin
( ) sin cos
P
P
P
x t C t C t
x t C t C t
x t C t C t
e e
e e e e
e e e e
= +
=
=



Substitute these expressions into the particular equation to obtain:

2 0
2 2
2 1 2 0 1 2
( ) ( ) sin
[ sin cos ] [ sin cos ] sin
P P
a x t a x t U t
a C t C t a C t C t U t
e
e e e e e e e
+ =
+ + =



At this stage we must solve fully for the unknown particular solution constants C
1
and C
2
,
independent of the initial conditions. To do so, we note that the sine terms and the cosine terms in the
above equation must balance separately, yielding two equations in the two particular solution unknowns
C
1
and C
2
.
2
2 1 0 1
2
2 2 0 2
sin :
cos : 0
t a C a C U
t a C a C
e e
e e
+ =
+ =


Due to the lack of damping in the model, the particular unknowns C
1
and C
2
are found independently.
1
2
0 2
U
C
a a e
=


2
0 C =

Now we have finished the particular solution for this problem:

2
0 2
( ) sin
P
U
x t t
a a
e
e
=



164
3. Total Solution. The total solution x(t) is the sum of the homogeneous solution x
H
(t) and the
particular solution x
P
(t).

1 2 2
0 2
( ) ( ) ( )
( ) cos sin sin
H P
n n
x t x t x t
U
x t B t B t t
a a
e e e
e
= +
= + +



At this stage we apply the given zero initial conditions to the total solution x(t) and its first derivative to
solve for the unknown homogeneous coefficients B
1
and B
2
.

1 2 2
0 2
1
(0) 0 cos(0) sin(0) sin(0)
0
U
x B B
a a
B
e
= = + +

=


1 2 2
0 2
1 2 2
0 2
2 2
0 2
( ) sin cos cos
(0) 0 sin(0) cos(0) cos(0)
( )
n n n n
n n
n
U
x t B t B t t
a a
U
x B B
a a
U
B
a a
e
e e e e e
e
e
e e
e
e
e e
= + +

= = + +



Finally, the general ODE IVP solution for the general undamped second-order case subject to harmonic
forcing is:

2 2
0 2 0 2
2
0 2
( ) sin sin
( )
( ) sin sin
n
n
n
n
U U
x t t t
a a a a
U
x t t t
a a
e
e e
e e e
e
e e
e e
= +

| |
= +
|

\ .
where
0
2
n
a
a
e =

Since we solved a linear ODE, there is a unique solution, x(t) above. The first term is a pure sine
wave with the natural frequency e
n
. The second term is a pure sine wave of different amplitude with the
driving frequency e. The steady-state solution is vibratory in nature, the sum of both these sine waves,
called the modes of vibration. These two terms are called the two modes of vibration; the first is the
natural (free) mode and the second is the forced mode.

A numerical example for this case is given in this 3012 Supplement, Section 6.2.1.2.

How do we check the x(t) results? See the Solution Validation on the following page, after the
shaking force derivation.


165
Forced Undamped Oscillator Shaking Force

After the x(t) solution is complete, we can calculate the shaking force for the forced undamped
case. Shaking force is defined as the force that impacts the ground link due to the system dynamics.
Redrawing the m-k translational mechanical system FBD to include the ground link, we see that it is
easy to calculate the shaking force in this case.



1-dof Forced Translational Mechanical System Free-Body Diagram with Ground Link

In the above FBD, is the spring force f
S
(t) equal to the input force f(t)? No, due to the vibrational
dynamics. However, the spring force is the shaking force as seen above and it can simply be calculated
from Hookes law, since the spring is massless.

So the shaking force for the second-order translational mechanical Harmonic Oscillator is:

shake S 2
0 2
( ) ( ) ( ) sin sin
n
n
kU
F t f t kx t t t
a a
e
e e
e e
| |
= = + = +
|

\ .



Harmonically-Forced Undamped Second-Order System Solution Validation

After one obtains the solution to an ODE, the next important step is to check the solution x(t) to
ensure it is correct. We now present two ways to validate the solution, the first partial and the second
complete.

First, we can check the initial conditions of the resulting solution to ensure they are correct. For
the initial position we substitute t =0 into the function x(t), and for the initial velocity we substitute t =0
into the function ( ) x t .

2
0 2
2
0 2
( ) sin sin
(0) sin(0) sin(0)
(0) 0
n
n
n
U
x t t t
a a
U
x
a a
x
e
e e
e e
e
e e
| |
= +
|

\ .
| |
= +
|

\ .
=

2
0 2
2
0 2
( ) ( cos cos )
(0) ( cos(0) cos(0))
(0) 0
n
U
x t t t
a a
U
x
a a
x
e
e e
e
e
e
= +

= +



So we see both required zero initial conditions are achieved by our solution x(t). This is a weak
check, since it only looks at t =0. A second, stronger solution check is to substitute x(t) and its second
166
derivative into the original ODE and ensure that an equality results. This is a complete check. First,
here are the displacement solution x(t) and its two time derivatives.

2
0 2
2
0 2
2
0 2
( ) sin sin
( ) ( cos cos )
( ) ( sin sin )
n
n
n
n n
U
x t t t
a a
U
x t t t
a a
U
x t t t
a a
e
e e
e e
e
e e
e
e
e e e e
e
| |
= +
|

\ .
= +



Now we substitute ( ), ( ) x t x t into the undamped forced translational mechanical system ODE and
simplify, using
0
2
n
a
a
e = .

( )
2 0
0 2
2 2
0 2 0 2
2
2 0 0 2
2 2 2 2
0 2 0 2 0 2 0 2
2 0
2
0 2 0
( ) ( ) sin
sin sin sin sin sin
sin sin sin sin sin
n n n
n
n
n n
n
n
a x t a x t U t
a U a U
t t t t U t
a a a a
a U a U a U a U
t t t t U t
a a a a a a a a
a U a U
a a a
e
e e
e e e e e e e
e e e
e e e e
e e e e e
e e e e e
e e
e
+ =
| |
+ + =
|

\ .
| | | |
+ + =
| |

\ . \ .

2
0 2
2 2 2
2 0 2 0 2
2 0
2 2 0 2
0 2
2
2 2 0
0 2 2
0 2
0
2
0 2
sin sin sin
sin ( )sin sin
sin ( )sin sin
n
n
n n
n
n
n
n n
n
a U a U
t t U t
a a a a a
a U
a t a a t U t
a a
a a U
t a a t U t
a a
a a U
a a
e e
e e e
e e e e
e
e e e e e e
e e
e e e
e e e e
e e e
e
e e
| | | |
+ + =
| |

\ . \ .
( | |
+ + =
( |

\ .
( | |
+ =
( |

\ .

2 0
0 2
2
0 2 2
0 2
sin ( )sin sin
( )sin sin
sin sin
n
n
t a a t U t
U
a a t U t
a a
U t U t
e
e e e e
e
e e e
e
e e
( | |
+ =
( |
\ .
( =

=


Since a valid equation results, i.e. sin sin U t U t e e = , this means the unique ODE solution is correct.



167
Analytical Solution via the Laplace Transform Method

Let us solve the same general harmonically-forced undamped second-order IVP ODE using an
alternative method: Laplace Transforms. Since we are solving a linear ODE, there is a unique solution,
which we have found using the Slow ME Way and validated by direct substitution.

The Problem Statement is the same:

Solve
2 0
( ) ( ) ( ) a x t a x t u t + = for x(t) given a
2
, a
0
, ( ) sin u t U t e = , and zero initial conditions

0
0
(0) 0
(0) 0
x x
x v
= =
= =


In contrast to the Slow ME Way, ODE solution via Laplace Transforms is accomplished
algebraically in the Laplace frequency domain, in a single step, including the forcing function and initial
conditions.

The first step is to take the Laplace Transform of both sides of the ODE, including the initial
conditions and forcing function, and solving algebraically for the unknown in the Laplace domain,
( ) { ( )} X s L x t = .

{ }
2 0
2
2 0 2 2
2
2 0 2 2
2 2 2
2 0
( ) ( ) sin
( ( ) (0) (0)) ( )
( ) ( )
( )
( )( )
L a x t a x t U t
a s X s sx x a X s U
s
a s a X s U
s
U
X s
a s a s
e
e
e
e
e
e
e
+ =
+ =
+
+ =
+
=
+ +



Note that the system characteristic polynomial
2
2 0
as a + appears when using the Laplace
Transform method. To find the solution in the time domain, x(t), we must take the inverse Laplace
Transform of X(s).

{ }
1
1
2 2 2
2 0
( ) ( )
( )
( )( )
x t L X s
U
x t L
a s a s
e
e

=

=
`
+ +
)


We find no Laplace Transform entries matching this X(s), so we must first perform the Heaviside Partial
Fraction Expansion on X(s) to break it into manageable pieces that are found in the Laplace Transform
Table.

3 4 1 2
2 2 2 2 2 2
2 0 2 0
( )
( )( ) ( ) ( )
C s C Cs C U
X s
a s a s a s a s
e
e e
+ +
= = +
+ + + +


168
Where the Heaviside Partial Fraction unknown constants C
1
, C
2
, C
3
, C
4
are called the residues. Note
that we break X(s) into a sum of terms each with a single denominator factor from the original. Also
note that the order of each numerator polynomial in s must be one less that the order of its denominator.
If you can factor a denominator into real factors, do so if they are imaginary, do not factor.
Immediately upon breaking apart X(s) into the partial fraction expansion, we express it again over a
common denominator, and equate it to the original X(s).

2 2 2
1 2 2 0 3 4
2 2 2 2 2 2
2 0 2 0
( )( ) ( )( )
( )
( )( ) ( )( )
Cs C s a s a C s C U
X s
a s a s a s a s
e e
e e
+ + + + +
= =
+ + + +


Equating the numerators we have:

2 2 2
1 2 2 0 3 4
3 2 2 2 3 2
1 2 1 2 2 3 0 3 2 4 0 4
3 2 2 2
1 2 3 2 2 4 1 0 3 2 0 4
( )( ) ( )( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
C s C s a s a C s C U
C s C s C s C a C s a C s a C s a C U
C a C s C a C s C a C s C a C U
e e
e e e
e e e
+ + + + + =
+ + + + + + + =
+ + + + + + + =


Balancing the powers of s coefficients on the left- and right-hand-sides of the above equation yields four
linear equations in four unknowns.

3
1 2 3
2
2 2 4
1 2
1 0 3
0 2
2 0 4
0
0
0
s C a C
s C a C
s C a C
s C a C U
e
e e
+ =
+ =
+ =
+ =

2 1
2
0 3
1 0
0
a C
a C e
(
=
` `
(
) )

2 2
2
0 4
1 0 a C
a C U e e
(
=
` `
(
) )


The solution to the Heaviside Partial Fraction unknown constants C
1
, C
2
, C
3
(the residues) is:

1
0 C =

2
2
2
0 2
a U
C
a a
e
e
=


3
0 C =

4
2
0 2
U
C
a a
e
e
=



And substituting into X(s) yields

3 4 1 2
2 2 2
2 0
2 4 2
2 2 2 2 2 2 2 2
2 0 0 2 2 0 0 2
0
2
2 2 2 2 2 2
2 2 0 2 0 2 0 0 0
2 2 2
( )
( ) ( )
1 1
( )
( ) ( ) ( ) ( )
1
( )
( ) ( )
C s C C s C
X s
a s a s
C C a U U
X s
a s a s a a a s a a a s
a
a U U
X s
a a s a a s a a a
s s
a a a
e
e e
e e e e
e e e
e
e e e e
+ +
= +
+ +
= + = +
+ + + +
(
(
(
= + = +
(
+ + | | | |
+ +
(
| |
(
\ . \ .
(
(
(
(
(
(



Consulting a table of Laplace Transforms, such as in Appendix B, we find an applicable entry.

169
2 2
sin t
s
e
e
e

+

{ }
0
2 1 1
2 2 2
2 0 2 0 0
2 2
2
0 2
( ) ( )
( )
( ) sin sin
n
n
a
a U
x t L X s L
a a s a a
s
a a
U
x t t t
a a
e e
e e
e
e e
e e




= = +
`
+ | |

+
|

\ .
)
(
= +
(



where
0
2
n
a
a
e =


As predicted, this solution agrees with the solution derived via the Slow ME Way we have validated
this solution and presented a numerical example so we neednt repeat this work since it is the same.

170
Analytical Solution via MATLAB dsolve

Let us solve the same general forced undamped second-order system IVP ODE using another
alternative method: the MATLAB function dsolve. The Problem Statement is again the same:

Solve
2 0
( ) ( ) sin a x t a x t U t e + = for x(t) given a
2
, a
0
, and zero initial conditions
(0) 0
(0) 0
x
x
=
=


The MATLAB code below, contained in VibesDsolve.m, shows how to analytically solve
this second-order IVP ODE using MATLAB function dsolve and display the analytical solution
results to the screen.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Anal yt i cal sol ut i on f or t he f or ced second- or der syst em
% ODE usi ng symbol i c MATLAB f unct i on dsol ve.
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c;
cl ear ;

syms a0 a2 x0 v0; %decl ar e symbol i c var i abl es

x = dsol ve( a2*D2x+a0*x=U*si n( w*t ) , Dx( 0) =0 , x( 0) =0 ) ; %sol ve
pr et t y( x) %di spl ay


The dsolve result is:
1/2
a0 t 1/2
sin(-------) U w a2
1/2
a2 U sin(w t)
---------------------- - -----------
1/2 2 2
a0 (-a0 + w a2) -a0 + w a2

Which is the same as our previous result:
2
0 2
( ) sin sin
n
n
U
x t t t
a a
e
e e
e e
| |
= +
|

\ .

0
2
n
a
a
e =

Note MATLAB dsolve can also solve ODEs analytically given numerical parameter and initial
condition values.


171
6.2.1.2 Undamped Second-Order Harmonically-Forced Responses Numerical Example
Given an undamped translational mechanical m-k system, assuming frictionless motion and a
zero initial conditions, determine and plot the time response to the given harmonic forcing function.

Solve ( ) ( ) ( ) mx t kx t f t + = for x(t)

Given m =10 kg, k =10t
2
N/m, ( ) sin 0.5sin8 f t F t t e t = = , and zero initial conditions:
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =

Solution
This example is solved in MATLAB file SecondForce.m. From our earlier general
harmonically-forced second-order solution, the natural frequency e
n
and the forced undamped second-
order system response x(t) are:
2
0
2
10 rad
10 sec
n
a k
a m
t
e t = = = =

( ) ( ) 0.0000804 8sin sin8 x t t t t t =

The total solution is a linear superposition of two vibratory modes, one of larger amplitude
vibrating at the natural frequency e
n
and a second of smaller amplitude vibrating at the driving
frequency e. The associated time periods for these two modes, visible in the plot below, are:
2 2
2 sec
n
n
T
t t
e t
= = =

2 2 1
sec
8 4
T
t t
e t
= = =

Forced m-k System Numerical Example x(t) Time Response

172
From the above time response we clearly see that the dominant vibrational time period is T
n
=2
sec, as calculated. Upon this SHM mode is superimposed the forced mode of higher frequency (with
associated T = sec) and smaller amplitude, as seen above. This complicated periodic response
oscillates theoretically forever. The combined sinusoidal waves oscillate symmetrically about the
neutral spring location x =0. At t =0, the initial value is 0 m and the slope is also zero, as specified by
the zero initial conditions.

To better understand this time response x(t), the next plot shows the homogeneous and particular
solution components, along with the total solution (same as above).




Numerical Example Second-Order x(t) Vibratory Forced Response Components

In this example, there is no transient response as such, since the homogeneous solution does not
disappear given enough time, but continues to vibrate since there is no damping in the model. The
homogeneous solution is not driven by initial conditions, which are zero, but by the sinusoidal input
forcing function f(t).

The separate homogeneous and particular solutions above are called the modes of vibration.
These linearly sum to yield the overall total solution x(t).

173
Below we plot the same x(t) response for the same example as the above two plots, along with its
first and second derivatives. These three are arranged separately on a subplot since their magnitudes are
different; the acceleration is the largest, then the velocity, and the position magnitudes are the smallest.
We see that the acceleration reaches steady-state before the velocity, which reaches steady-state before
the position. We see both initial conditions, i.e. zero initial position and velocity. It also turns out that
the initial acceleration is zero, though this is not specified since it is only a second-order problem. What
are the relationships amongst these plots, from Calculus?




Same Undamped Numerical Example with Position Velocity, and Acceleration



174
Now we plot the same response for the same example as the above three plots, this time showing
the ( ) x t vs. x(t) phase plot. To emphasize the steady-state behavior (vibratory response to the harmonic
forcing function), the plot below includes time up to 2 sec, instead of 6 sec as before. Since the natural
frequency period is T
n
=2 sec, the phase plot repeats every 2 sec. In this case the natural frequency
period dominates since it is longer than the driving frequency period. How do we interpret this
complicated graph? Where is time on this graph?




Same Undamped Numerical Example, Phase Plot



175
Let us repeat the above numerical example, only changing the driving frequency e.
( ) sin 0.5sin
2
f t F t t
t
e = =

The associated driven-mode time period T is:
2 2
4 sec
2
T
t t
t
e
= = =

The new time response is plotted below.


Numerical Example Second-Order x(t) Vibratory Forced Response with Lower e

The natural frequency e
n
is unchanged and the new second-order response x(t) is:
2
0
2
10 rad
10 sec
n
a k
a m
t
e t = = = =

1
( ) 0.0068 sin sin
2 2
x t t t
t
t
| |
= +
|
\ .


Again the total response is the superposition of the two modes of vibration. But this time the
dominant mode is the driving mode, with T =4 sec and a larger amplitude, upon which is superimposed
the natural mode with the same time period is T
n
=2 sec as before, and a relatively-lower amplitude
(half). Again, this complicated periodic response oscillates theoretically forever, as long as the input
force is applied. The combined sinusoidal waves oscillate symmetrically about the neutral spring
location x =0. At t =0, the initial value is 0 m and the slope is also zero, as specified by the zero initial
conditions.

176
To better understand this time response x(t), the next plot shows the homogeneous and particular
solution components, along with the total solution (same as above).




Numerical Example Second-Order x(t) Vibratory Forced Response Components



177
Below we plot the same x(t) response for the same example as the above two plots, along with its
first and second derivatives. These three are arranged separately on a subplot since their magnitudes are
different; the acceleration is the largest, then the velocity, and the position magnitudes are the smallest.
We see that the acceleration reaches steady-state before the velocity, which reaches steady-state before
the position. We see both initial conditions, i.e. zero initial position and velocity. It also turns out that
the initial acceleration is zero, though this is not specified since it is only a second-order problem. What
are the relationships amongst these plots, from Calculus?




Second Undamped Numerical Example with Position Velocity, and Acceleration



178
Now we plot the same response for the same example as the above three plots, this time showing
the ( ) x t vs. x(t) phase plot. To emphasize the steady-state behavior (vibratory response to the harmonic
forcing function), the plot below includes time up to 4 sec, instead of 8 sec as before. Since the driving
frequency period is T =4 sec, the phase plot repeats every 4 sec. All plot results above also repeat every
4 sec. In this case the driving frequency period dominates since it is longer than the natural frequency
period . How do we interpret this graph? Where is time on this graph?




Second Undamped Numerical Example, Phase Plot


All plots in this subsection were generated using MATLAB file SecondForce.m.


179
6.2.1.3 Beat Frequency

In a vibrational system with two modes, such as an unforced 2-dof vibrational system, or a
harmonically-forced undamped m-k translational system, whenever the two frequencies of vibration are
close to each other, the resulting x(t) response demonstrates a beat frequency pattern.

For example, let us run the same numerical example from earlier, this time with the driving
frequency e closer to the natural frequency e
n
than in the two previous cases.

Solve ( ) ( ) ( ) mx t kx t f t + = for x(t)

Given m =10 kg, k =10t
2
N/m, ( ) sin 0.5sin0.9 f t F t t e t = = , and zero initial
conditions
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =


In this case the driving frequency is e =0.9t rad/sec, much closer to the natural frequency e
n
=t than
either of the two previous examples (8t and t/2, respectively).


Solution

The natural frequency e
n
is unchanged and the new response x(t) is:
rad
sec
n
k
m
e t = =

( ) ( ) 0.0267 0.9sin sin0.9 x t t t t t = +

The total solution is a linear superposition of the two vibratory modes, whose natural frequency
e
n
and driving frequency e are close to each other. Note that the two vibrational mode amplitudes are
also closer to each other since
n
e e is closer to 1. The associated steady-state solution time periods for
these two modes are also close.

2 2
2 sec
n
n
T
t t
e t
= = =

2 2
2.22 sec
0.9
T
t t
e t
= = =

180


Forced m-k System Numerical Example x(t) Time Response with Beat Frequency

From the above time response, generated using MATLAB file SecondForce.m, we see that
the beat frequency is a curve with a relatively high frequency vibrating within a sinusoidal envelope of
lower frequency. Note that the maximum amplitude is much higher than the previous two examples,
despite using the same parameters m, k, and the same forcing function amplitude, F =0.5 N. In 40 sec,
the beat vibration has gone through two complete cycles as shown above.


181
6.2.1.4 Undamped Resonance
Resonance in vibrational systems is potentially a big problem. When the driving frequency e is
the same as, or very close to, the systems natural frequency e
n
, the resulting amplitude of the steady-
state vibration becomes very large. Some systems may be able to harness resonance for good, but
generally resonance is something to avoid since it could damage the system or environment.

For the second-order undamped vibrational m-k model:

( ) ( ) sin mx t kx t F t e + =

Recall that the steady-state solution is (substituting parameters F, k, and m for U, a
0
, and a
2
,
respectively, in the general particular solution):
2 2
0 2
( ) sin sin
P
U F
x t t t
a a k m
e e
e e
= =



Define the steady-state vibrational amplitude A.
2
F
A
k me
=



Defining r to be the ratio of the driving frequency e to the natural frequency e
n
, the amplitude A can be
genericized by the dividing the numerator and denominator by the spring constant k.
n
r
e
e
=

2 2
2
2
1
1
n
F
F k F k
k
A
k m
r
k k
e
e
e
= = =



where
n
k
m
e =

The phase angle | in the above steady-state solution sin( ) A t e | is zero, for r <1. For r >1, one way
to account for the negative sign arising due to the denominator of A is to specify that the phase angle is
| t = , that is, 180 | =

.

Plotting the resulting steady-state vibrational amplitude and phase angle vs. frequency is called
the frequency response of the undamped system. Let us plot the normalized, dimensionless, amplitude
M and the phase angle | vs. the dimensionless frequency ratio r.
2
1
1
A
M
F k r
= =


1
2
0
tan
1 r
|

(
=
(




M stands for the amplitude magnification factor, i.e. the calculated amplitude of vibration A compared to
the generic F / k input magnitude. M is dimensionless, e.g. length / length for the translational
mechanical system. The amplitude magnification and phase angle plots are given on the next page,
generated using Resonance.m. We see that for r <1 the motion is in phase and for r >1 the motion is
180

out of phase. For r =1, there is resonance with infinite amplitude and undefined phase angle.

We will present more details on vibrational resonance in the harmonically-forced damped
second-order section to follow.

182

Undamped Frequency Response: Amplitude vs. r


Undamped Frequency Response: Phase Angle vs. r

For sample time responses, see the next two pages.
183
The frequency response plots (magnitude and phase angle vs. dimensionless frequency ratio r)
presented above in the Undamped Resonance section do not show the effect of r on the vibratory time
response. Therefore, this is presented on the current page.
Given m =10 kg, k =10t
2
N/m, ( ) 0.5sin f t t e = , and zero initial conditions, the subplots below
give the time response for various values of
n
r e e = , given in the legend table below.


Undamped Resonance Example Sample Time Responses Total Solution

r =0.01 r =0.1
r =0.5 r =0.9999
r =2 r =3

All plots have the same horizontal time scale and the same vertical displacement scale for easy
comparison. The r =0 case yielded a flatline response in MATLAB; hence we used 0.01 to start. The r
=1 case is the resonant case, yielding NaN in MATLAB; hence we used r =0.9999 for successful
numerical simulation. This resonant case amplitude goes to given enough time.
For r <1 we see that the vibratory solution displacement amplitude increases as r increases and
for r >1 we see that the vibratory solution displacement amplitude decreases as r increases.

184
The vibratory time responses presented on the previous page are the total response x(t). For
clarity this page presents the same vibratory time responses, but for the particular solution only.



Undamped Resonance Example Sample Time Responses: Particular Solution

r =0.01 r =0.1
r =0.5 r =0.9999
r =2 r =3

For r <1 we see that the vibratory solution displacement amplitude increases as r increases and
the frequency of vibration also increases. For r >1 we see that the vibratory solution displacement
amplitude decreases as r increases, while the frequency of vibration still increases. Also, for r <1 we
see that the phase angle is zero, while for r >1 the phase angle is 180 deg.

Again, the r =1 case is the resonant case with theoretically infinite amplitude. r =0.9999 is
close, which has an amplitude about 4000x the other cases.


185
6.2.1.5 Undamped Second-Order Harmonically-Forced Numerical ODE Solutions
Numerical Solution via MATLAB ode45
Given the same harmonically-forced translational mechanical m-k system from the previous
numerical example, find the solution numerically using MATLAB function ode45. This function
implements the fourth/fifth-order Runge-Kutta numerical solution for ODEs.

Solve ( ) ( ) ( ) mx t kx t f t + = for x(t)

Given m =10 kg, k =10t
2
N/m, ( ) sin 0.5sin8 f t F t t e t = = , and zero initial conditions
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =

Usage
[tout,yout] = ode45(odefun,tspan,Y0);
odefun is a function handle to the function containing the ODE right-hand-side.
Tspan = [t0 tfinal] is the time span
Y0 array of initial conditions on Y.

MATLAB function ode45 integrates the system of differential equations y = f(t,y) from time
t0 to tfinal with initial conditions Y0.
So we must first express the ODE in the MATLAB-accepted form y = f(t,y), i.e. convert
the single second-order ODE into two first-order ODEs. Define:
1
2 1
2 1
( ) ( )
( ) ( ) ( )
( ) ( ) ( )
x t x t
x t x t x t
x t x t x t
=
= =
= =



1 2
2 1
( ) ( )
( ) ( ) sin
x t x t
k F
x t x t t
m m
e
=
= +



Here is MATLAB m-file OdeToE452.m to solve the harmonically-forced second-order ODE
numerical example using MATLAB function ode45.
clear; clc;
[t,x] = ode45(@SecundForc,[0 6],[0 0]); % (fn name, t range, X0)
figure;
plot(t,x(:,1)); grid;

The function containing the ODE RHS is given below. This function SecundForc.m must be in the
MATLAB search path.

function dx = SecundForc(t,x)
m = 10; k = 10*pi^2; F = 0.5; w = 8*pi;
dx = zeros(2,1); % a column vector
dx(1) = x(2);
dx(2) = -(k/m)*x(1) + F*sin(w*t)/m;

The plot generated by this MATLAB m-file is identical to that presented earlier in the numerical
example, so it is not repeated here. The same is true for ( ) 0.5sin( / 2) f t t t = , and the beat frequency
example ( ) 0.5sin0.9 f t t t = .

186
Numerical Solution via MATLAB function lsim
In Section 6.1 we solved the unforced second-order translational m-k mechanical system ODE
numerical example numerically using MATLAB function initial. Here we use MATLAB function
lsim, to numerically solve the same numerical example with a harmonic input forcing function. We
will again use the state-space description for the mechanical m-k system.
0 1
0
k
m
(
(
=
(


A
0
1
m
(
(
=
(

B
| |
1 0 = C
| |
0 = D

Solve ( ) ( ) ( ) mx t kx t f t + =
for x(t), using MATLAB function lsim

Given m =10 kg, k =10t
2
N/m, ( ) sin 0.5sin8 f t F t t e t = = , and zero initial conditions
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =


[y,t,x] = lsim(SysName,u,t,X0); time response to arbitrary inputs.
Y output vector
t time array chosen by MATLAB (yes, its on both sides)
x resulting state vector
SysName system model composed of A, B, C, D
X0 vector of initial conditions if left off, MATLAB assumes zero

Here is some MATLAB code, contained in SecondForce.m, to solve the harmonically-forced first-
order ODE numerical example using MATLAB function lsim:
clear; clc;
m = 10; k = 10*pi^2; F = 0.5; w = 8*pi;
A = [0 1;-k/m 0]; % define ABCD state-space matrices
B = [0; 1/m];
C = [1 0];
D = [0];
mk = ss(A,B,C,D); % define a state-space model in MATLAB
t = [0:0.01:6]; % time array
f = F*sin(w*t); % harmonic forcing function
[y,t,x] = lsim(mk,f,t); % solve the forced value problem numerically
% with zero initial conditions

figure;
plot(t,y); grid;
set(gca,FontSize,18);
xlabel({\ittime} ({\itsec}));
ylabel({\itx(t)} from lsim ({\itm}));

The plot generated by this MATLAB m-file is identical to that presented earlier in the numerical
example, so it is not repeated here. The same is true for ( ) 0.5sin( / 2) f t t t = .

187
6.2.2 Damped Second-Order System Harmonically-Forced Responses

We know that forced undamped second-order system motion is impossible in the real world
since there is always energy loss for all dynamic systems. Therefore, this section presents solution of
the harmonically-forced second-order system model with friction included via a linear damping model.
There are four damping cases to consider: undamped (done in Section 6.2.1), underdamped, critically-
damped, and overdamped. These four distinct damping cases depend on the size of the damping
coefficient relative to the mass m and spring constant k.

6.2.2.1 Analytical Damped Second-Order Harmonically-Forced ODE Solutions

Again, we have seen earlier that different physical system models will lead to the same
externally-forced, damped second-order ODE form.





( ) ( ) ( ) ( ) mx t cx t kx t f t + + = ( ) ( ) ( ) ( )
R R
J t c t k t t u u u t + + =

( ) ( ) ( ) ( )
R
g
t c t t t
L
u u u t + + =



In this section we will solve ( ) ( ) ( ) ( ) mx t cx t kx t f t + + = , a harmonically-forced, damped
second-order ODE subject to ( ) sin f t F t e = and zero initial conditions and demonstrate the basic
harmonically-forced second-order system motion that results. Again, F is the forcing function
amplitude and e is the harmonic forcing circular frequency (rad/sec), the driving frequency. All
forced, damped second-order systems presented in ME 3011 modeling, and others, can be solved in the
same manner as presented here, substituting the appropriate parameters and values in each case.
Problem Statement

Solve ( ) ( ) ( ) ( ) mx t cx t kx t f t + + = for x(t) given m, c, k, ( ) sin f t F t e = , and zero initial
conditions.
0
0
(0) 0
(0) 0
x x
x v
= =
= =


This is the forced initial value problem (IVP) from ordinary differential equations.

Analytical Solution via the Slow ME Way

Taking advantage of linear superposition, the total solution x(t) is the sum of the homogeneous
solution x
H
(t) plus the particular solution x
P
(t). The homogeneous solution is the transient response to
the initial conditions and the input harmonic forcing function and the particular solution is the steady-
state response to the input harmonic forcing function only.

f(t)
x(t)
m
c
k
J
k
(t)
R
u
(t) t
c
R
m
u
L
g
(t)
t(t)
c
R
188
1. Homogeneous Solution. Recall from Section 6.1 that the general mechanical
translational m-c-k system can be genericized by using the definitions of natural frequency e
n
(rad/sec)
and dimensionless damping ratio (unitless).

0
2
n
a k
m a
e = =

1
0 2
2 2
a c
km a a
= =

2
( ) 2 ( ) ( ) 0
H n H n H
x t x t x t e e + + =

Recall, for the homogeneous solution, the characteristic polynomial and its roots are:
2 2
2 0
n n
s s e e + + =

2
1,2
1
n n
s e e =


This yields four distinct cases, considered in detail below: undamped ( =0), underdamped (0 1 < < ),
critically-damped ( =1), and overdamped ( >1).

The homogeneous solution x
H
(t) and was presented in Section 3.3.1; it is the solution to the
unforced ODE
2
( ) 2 ( ) ( ) 0
H n H n H
x t x t x t e e + + = . There are four cases, summarized below.

undamped
1 2
( ) cos sin
H n n
x t B t B t e e = +
underdamped | |
1 2
( ) cos sin
n
t
H d d
x t e B t B t
e
e e

= +

2
1
d n
e e =
critically-damped
1 2
( )
n n
t t
H
x t Be B te
e e
= +
overdamped
1 2
1 2
( )
s t s t
H
x t B e B e = +

2
1,2
1
n n
s e e =

The unknown homogeneous solution coefficients B
1
and B
2
must remain unknown for now. They will
be found later, in applying the initial condition to the total solution, after the Particular Solution is
found. The Particular Solution, presented below, has an identical form for all four damping cases.

2. Particular Solution. The particular solution x
P
(t) is the solution to the forced ODE:

( ) ( ) ( ) sin
P P P
mx t cx t kx t F t e + + =

We must assume a particular solution form consistent with the form of the harmonic forcing function
( ) sin f t F t e = .

1 2
( ) sin cos
P
x t C t C t e e = +

That is, for the harmonic forcing case with a sine function input and zero phase angle, the particular
solution must allow a non-zero phase angle, expressed above by including a cosine function along with
the sine function form. Note that the frequency of the assumed particular solution form (both sine and
cosine) must be identical to the driving circular frequency e.

The assumed particular solution form and its first two derivatives are:

189
1 2
1 2
2 2
1 2
( ) sin cos
( ) cos sin
( ) sin cos
P
P
P
x t C t C t
x t C t C t
x t C t C t
e e
e e e e
e e e e
= +
=
=



Substitute these forms into the particular equation to obtain:

2 2
1 2 1 2 1 2
( ) ( ) ( ) sin
[ sin cos ] [ cos sin ] [ sin cos ] sin
P P P
mx t cx t kx t F t
m C t C t c C t C t k C t C t F t
e
e e e e e e e e e e e
+ + =
+ + + =



At this stage we must solve fully for the unknown particular solution constants C
1
and C
2
,
independent of the initial conditions. To do so, we note that the sine terms and the cosine terms in the
above equation must balance separately, yielding two equations in the two particular solution unknowns
C
1
and C
2
.

2
1 2 1
2
2 1 2
sin :
cos : 0
t m C c C kC F
t m C c C kC
e e e
e e e
+ =
+ + =


This set of equations is linear in the unknowns C
1
and C
2
so we can use a matrix-vector approach to
solve them.

2
1
2
2
0
C F k m c
C c k m
e e
e e
(
=
` ` (

) )

1
2
1
2
2
0
C F k m c
C c k m
e e
e e

(
=
` ` (

) )

2
2 2 2 2
1
2 2 2 2
2
2 2 2
( )
( ) ( ) 1
0 ( ) ( )
( ) ( )
k m F
C F k m c k m c
C k m c c k m c F
k m c
e
e e e e
e e e e e
e e


( +
= =
` ` ` (
+
) )

+
)


Now we have completed the particular solution for this problem.

2
2 2 2
( ) ( )sin cos
( ) ( )
P
F
x t k m t c t
k m c
e e e e
e e
( =

+


An alternate solution form for x
P
(t) which is mathematically equivalent is found by applying the
sum of angles trigonometric formula for sine.

sin( ) sin cos cos sin a b a b a b =

Here the two-dof are expressed as an overall amplitude A and a phase angle |:

2
2 2 2
( )sin cos sin( ) [sin cos cos sin ]
( ) ( )
F
k m t c t A t A t t
k m c
e e e e e | e | e |
e e
( = =

+

190

Matching sinet and coset terms, we have:

2
2 2 2
2 2 2
( )
cos
( ) ( )
sin
( ) ( )
k m F
A
k m c
c F
A
k m c
e
|
e e
e
|
e e

=
+
=
+


Solving for the alternate solution unknowns A and |:

( )
2 2
2
2 2 2 2
2 2 2 2 2 2
2 2 2 2
2
2
2 2 2
2 2 2
( )
cos sin (1)
( ) ( ) ( ) ( )
( ) ( )
( ) ( )
( ) ( )
k m F c F
A A
k m c k m c
k m c F
A
k m c
F
A
k m c
e e
| |
e e e e
e e
e e
e e
( (
+ = = +
( (
+ +

( +

=
( +

=
+

1
2
tan
c
k m
e
|
e

(
=
(




where we further used the trigonometric identity
2 2
cos sin 1 | | + = . So the alternate particular solution
form is:

( ) sin( )
P
x t A t e | =
2 2 2
( ) ( )
F
A
k m c e e
=
+

( )
2
atan2 , c k m | e e =

where atan2 is the MATLAB quadrant-specific inverse tangent function. The input to atan2 must be
(num,den) rather than a single ratio as in the atan case.

Phasor Representation of Particular Solution. Recall from the unforced SHM solution that the
velocity vector v(t) leads the position vector x(t) by 90

and the acceleration vector a(t) leads the


velocity vector v(t) by 90

(thus the acceleration vector a(t) leads the position vector x(t) by 180

).

Again using phasor notation for the vectors, the external harmonic input force is:

( )
i t
f t Fe
e
=

where e is the driving frequency. We know that the particular solution position vector x(t) must lag the
input force vector f(t); call this phase angle . Then the position vector phasor is:

( )
( )
i t
x t Ae
e
=

whose two time derivatives are:

191
( )
2 2 ( ) 2 ( )
( )
( )
i t
i t i t
x t iA e
x t i A e A e
e
e e
e
e e


=
= =



We can draw a rotating diagram for the particular solution similar to that of the unforced SHM
solution. This diagram displays the relationship amongst the position, velocity, and acceleration vectors
relative to the input forcing function. The magnitudes are constant, but the XY (i.e. ReIm) components
are always changing due to the continual rotation of this diagram at the constant angular velocity of e,
the driving frequency (see the figure below).


Rotating Phasor Diagram for Particular Solution

Where is the phase angle lag of the position vector x(t) relative to the excitation force f(t) and A is the
amplitude of the vibration x(t). The mechanical impedances for the mass, damper, and spring elements
are me
2
, ice, and k, respectively.

Note that for the undamped case, this rotating plane diagram above for the particular solution
collapses to a rotating collinear diagram with =0.


Generic Expression of Particular Solution. Note the particular solution terms may be converted
to a generic description as follows.

2 2 2
( ) ( )
F
k
A
k m c
k k k
e e
=
+

2
2 2
2
2
(1 ) ( )
n n
F
k
A
e e
e e
=
+

1
2
tan
c
k
k m
k k
e
|
e

(
(
=
(
(


1
2
2
2
tan
1
n
n
e
e
|
e
e

(
(
(
=
(

(



Or, defining r to be the ratio of the driven frequency to the natural frequency,
n
r
e
e
= :
e
A
2
e A
e A
x(t)
v(t)
a(t)
F(t)
e

t
192

2 2 2
(1 ) (2 )
F k
A
r r
=
+

1
2
2
tan
1
r
r

|

(
=
(







3. Total Solution. The total solution x(t) is the sum of the homogeneous solution x
H
(t) and the
particular solution x
P
(t).

( ) ( ) ( )
( ) ( ) sin( )
H P
H
x t x t x t
x t x t A t e |
= +
= +


At this stage we must apply the given zero initial conditions to the total solution x(t) to solve for the
unknown homogeneous solution coefficients B
1
and B
2
.

There are four sub-cases to consider in the homogeneous solution, with distinct solutions:
undamped, underdamped, critically-damped, and overdamped. The value of dimensionless damping
ratio , which is in turn dependent on the size of c relative to m and k, defines these four cases. We
solved the undamped case in Subsection 6.2.1 and next will solve only the underdamped case.

Underdamped System Total ODE Solution

In this case we have 0 1 < < and so the two system characteristic polynomial roots are
complex conjugates with negative real part.

2 2 2
1,2
1 ( 1)(1 ) 1
n n n n n n n d
s i i e e e e e e e e = = = =


where the damped frequency e
d
is defined to be
2
1
d n
e e = , which is real and has units rad/sec.
The total solution form for x(t) is:

| |
1 2
( ) ( ) ( )
( ) cos sin sin( )
n
H P
t
d d
x t x t x t
x t e B t B t A t
e
e e e |

= +
= + +



193
We need to derive ( ) x t in order to apply the velocity initial condition.

| | | |
1 2 1 2
( ) cos sin sin cos cos( )
n n
t t
n d d d d d d
x t e B t B t e B t B t A t
e e
e e e e e e e e e |

= + + + +

Applying the two given zero initial conditions gives us two equations in the two unknown homogeneous
constants B
1
and B
2
.

| |
| | | |
(0)
1 2
(0) (0)
1 2 1 2
(0) 0 cos(0) sin(0) sin( )
(0) 0 cos(0) sin(0) sin(0) cos(0) cos( )
n
n n
n d d
x e B B A
x e B B e B B A
e
e e
|
e e e e |


= = + +
= = + + + +


Simplifying using
(0)
1 e = , cos(0) =1, sin(0) =0, cos( ) cos( ) | | = , and sin( ) sin( ) | | = .

1
1 2
0 sin
0 cos
n d
B A
B B A
|
e e e |
=
= + +

1
1
2
sin
cos ( sin cos )
n n
d d
B A
B A A
B
|
e e | e | e |
e e
=

= =


Finally, the total x(t) solution for the case of harmonically-forced underdamped motion is

| |
1 2
( ) cos sin sin( )
n
t
d d
x t e B t B t A t
e
e e e |

= + +

where
2
1
d n
e e =

1
sin B A | =

2
( sin cos )
n
d
A
B
e | e |
e

=


2 2 2 2 2 2
( ) ( ) (1 ) (2 )
F F k
A
k m c r r e e
= =
+ +

1 1
2 2
2
tan tan
1
c r
k m r
e
|
e

( (
= =
( (



n
r
e
e
=



Since we solved a linear ODE, there is a unique solution, x(t) above.

The first term of x(t) is the transient response which dies out given enough time, due to the
damping envelope
n
t
e
e
. The underdamped transient response vibrates at the damped natural
frequency e
d
while it is damping out, due to the cosine and sine terms. The second term of x(t),
sin( ) A t e | , is the steady-state response which vibrates at the driving frequency e as long as the input
force is applied.

A numerical example for this case is given in this 3012 Supplement, Section 6.2.2.2.

How do we check the x(t) results? See the Solution Validation on the next page, after the
shaking force derivation.


194
Forced Underdamped Oscillator Shaking Force

After the x(t) solution is complete, we can calculate the shaking force for the forced
underdamped case. Shaking force is defined as the force that impacts the ground link due to the system
dynamics. Redrawing the m-k translational mechanical system FBD to include the ground link, we see
that it is easy to calculate the shaking force in this case.



1-dof Forced Translational Mechanical System Free-Body Diagram with Ground Link

In the above FBD, is the spring force f
S
(t) equal to the input force f(t)? No, due to the vibrational
dynamics. However, the spring force plus the damper force force is the shaking force as seen above and
it can simply be calculated from Hookes law and the viscous damper force/velocity relationship, since
the spring and damper are massless.

The general shaking force for the forced second-order translational mechanical Damped Oscillator is:

| |
| | | |
S
1 2
1 2 1 2
( ) ( ) ( )
cos sin sin( )
( ) cos sin sin cos cos( )
n
n n
t
d d
t t
n d d d d d d
f t kx t cx t
k e B t B t A t
c x t e B t B t e B t B t A t
e
e e
e e e |
e e e e e e e e e |


= + +
( = + + +

( + = + + + +



where
2
1
d n
e e =

1
sin B A | =

2
( sin cos )
n
d
A
B
e | e |
e

=




Harmonically-Forced Underdamped Second-Order System Solution Validation

After one obtains the solution to an ODE, the next important step is to check the solution x(t) to
ensure it is correct. We now present two ways to validate the solution, the first partial and the second
complete.

First, we can check the initial conditions of the resulting solution to ensure they are correct. For
the initial position we substitute t =0 into the function x(t), and for the initial velocity we substitute t =0
into the function ( ) x t .

195
| |
| |
| |
1 2
(0)
1 2
1 2
1
( ) cos sin sin( )
(0) cos(0) sin(0) sin(0 )
(0) (1) (1) (0) sin( )
(0) sin sin sin
(0) 0
n
n
t
d d
x t e B t B t A t
x e B B A
x B B A
x B A A A
x
e
e
e e e |
|
|
| | |

= + +
= + +
= +
= =
=

| | | |
| | | |
| | | |
1 2 1 2
(0) (0)
1 2 1 2
1 2 1 2
( ) cos sin sin cos cos( )
(0) cos(0) sin(0) sin(0) cos(0) cos(0 )
(0) (1) (1) (0) (1) (0) (1) co
n n
n n
t t
n d d d d d d
n d d
n d d
x t e B t B t e B t B t A t
x e B B e B B A
x B B B B A
e e
e e
e e e e e e e e e |
e e e e |
e e e e


= + + + +
= + + + +
= + + + +

1 2
s( )
(0) cos
( sin cos )
(0) sin cos
(0) sin ( sin cos ) cos
(0) 0
n d
n
n d
d
n n
x B B A
A
x A A
x A A A
x
|
e e e |
e | e |
e | e e |
e
e | e | e | e |
= + +
(
= + +
(

= + +
=



So we see both required initial conditions x
0
and v
0
are achieved by our solution x(t). This is a
weak check, since it only looks at t =0. A second, stronger solution check is to substitute x(t) and its
first and second derivatives into the original ODE and ensure that an equality results. This is a complete
check. First, since we have the general displacement solution x(t) and its first derivative ( ) x t , we must
take another time derivative to find ( ) x t .

| |
| | | |
| | | |
1 2
1 2 1 2
2 2
1 2 1 2
1
( ) cos sin sin( )
( ) cos sin sin cos cos( )
( ) cos sin sin cos
sin
n
n n
n n
n
t
d d
t t
n d d d d d d
t t
n d d n d d d d
t
n d d
x t e B t B t A t
x t e B t B t e B t B t A t
x t e B t B t e B t B t
e B
e
e e
e e
e
e e e |
e e e e e e e e e |
e e e e e e e e
e e e

= + +
= + + + +
= + +

| |
2 2
2 1 2
2
cos cos sin
sin( )
n
t
d d d d d d
t B t e B t B t
A t
e
e e e e e e
e e |

( + +




Simplifying ( ) x t

| | | |
2 2
1 2 1 2
2 2 2
1 2
( ) cos sin 2 sin cos
cos sin sin( )
n n
n
t t
n d d n d d d d
t
d d d d
x t e B t B t e B t B t
e B t B t A t
e e
e
e e e e e e e e
e e e e e e |

= + +
( +



Now we substitute ( ), ( ), ( ) x t x t x t into the original second-order ODE and simplify.

196
| | | |
| |
2 2
1 2 1 2
2 2 2
1 2
1 2 1 2
( ) ( ) ( ) ( ) sin
cos sin 2 sin cos
cos sin sin( )
cos sin sin cos
n n
n
n n
t t
n d d n d d d d
t
d d d d
t t
n d d d d d
mx t cx t kx t f t F t
m e B t B t m e B t B t
me B t B t mA t
c e B t B t ce B t B
e e
e
e e
e
e e e e e e e e
e e e e e e |
e e e e e e e


+ + = =
+ +
( +

+ + +

| |
| |
1 2
2 2 2 2
1 2 1 2
2 2 2
1 2
cos( )
cos sin sin( ) sin
cos sin 2 sin 2 cos
cos sin sin( )
n
n n n n
n n
d
t
d d
t t t t
n d n d n d d n d d
t t
d d d d
t cA t
ke B t B t kA t F t
m e B t m e B t m e B t m e B t
me B t me B t mA t
c
e
e e e e
e e
e e |
e e e | e
e e e e e e e e e e
e e e e e e |



+
+ + + =
+ +
+
+
1 2 1 2
1 2
2 2 2
1 1 1
cos sin sin cos cos( )
cos sin sin( ) sin
cos cos cos
n n n n
n n
n n n
t t t t
n d n d d d d d
t t
d d
t t t
n d d d n d
e B t c e B t ce B t ce B t cA t
ke B t ke B t kA t F t
m e B t me B t c e B t ke
e e e e
e e
e e e
e e e e e e e e e e |
e e e | e
e e e e e e



+ + +
+ + + =
+
1
2 2 2
2 2 2 2
1 1
2 2
2
cos
sin sin sin sin
2 sin sin
2 cos cos
( )sin( ) cos( ) s
n
n n n n
n n
n n
t
d
t t t t
n d d d n d d
t t
n d d d d
t t
n d d d d
B t
m e B t me B t c e B t ke B t
m e B t ce B t
m e B t ce B t
A k m t cA t F
e
e e e e
e e
e e
e
e e e e e e e
e e e e e
e e e e e
e e | e e |



+ +
+
+
+ + =
2 2 2 2 2 2
1 2
1 2
2
in
( ) cos ( ) sin
(2 ) sin ( 2 ) cos
[( )sin( ) cos( )] sin
n n
n n
t t
n d n d n d n d
t t
d n d d n d
t
B m m c k e t B m m c k e t
B m c e t B m c e t
A k m t c t F t
e e
e e
e
e e e e e e e e
e e e e e e
e e | e e | e


+ + +
+ + +
+ + =



Now we have some common terms which look like they may simplify using

n
k
m
e =

2
n
k me =

2 c km =

2 2 2
(1 )
d n
e e =

197
2 2 2 2 2 2 2
2 2 2
2
2
2
2
(1 )
2
(2 )
(2 2 )
2( )
2( )
2( )
2( )
0
n d n n n n
n n n
n n
n n
n n
n n
n n
n n n
m m c k m m c k
m m k c
m c k k
m km
m km
m
m km
m
k
m m
m
m m
e e e e e e
e e e
e e
e e
e e
e e
e e
e e e
+ = +
= +
= +
=
=
=
=
=
=

2 2 2
2 ( )
2 ( )
2 ( )
2 ( )
0
n n
n
n
n
n n
m c m km
m km
m
m km
m
k
m m
m
m m
e e
e
e
e
e e
=
=
=
=
=
=


Now our validation simplifies to:

1 2 1 2
2
2
(0) cos (0) sin (0) sin (0) cos
[( )sin( ) cos( )] sin
[( )sin( ) cos( )] sin
n n n n
t t t t
d d d d d d
B e t B e t B e t B e t
A k m t c t F t
A k m t c t F t
e e e e
e e e e e e
e e | e e | e
e e | e e | e

+ + +
+ + =
+ =


Let us use the trigonometric sum of angle formulae to work on the left-hand side of the above equation.

cos( ) cos cos sin sin
sin( ) sin cos cos sin
a b a b a b
a b a b a b
=
=



( ) ( )
2
2
2 2
[( )sin( ) cos( )]
[( ) sin cos cos sin cos cos sin sin ]
[( )sin cos ] cos [ ( )cos sin ] sin
A k m t c t
A k m t t c t t
k m t c t A k m t c t A
e e | e e |
e e | e | e e | e |
e e e e | e e e e |
+ =
+ + =
+ + +


From earlier in the particular solution we have:
2
2 2 2
( )
cos
( ) ( )
k m F
A
k m c
e
|
e e

=
+

2 2 2
sin
( ) ( )
c F
A
k m c
e
|
e e
=
+


Substituting the above formula into the above validation equation, we get

198
2
2
2 2
2 2 2 2 2 2
2 2 2
2 2 2 2 2 2
2
2 2
[( )sin( ) cos( )]
( )
[( )sin cos ] [ ( )cos sin ]
( ) ( ) ( ) ( )
( ) ( )
sin cos
( ) ( ) ( ) ( )
( )
( ) ( )
A k m t c t
k m F c F
k m t c t k m t c t
k m c k m c
k m F c k m F
t t
k m c k m c
c k m F
k m c
e e | e e |
e e
e e e e e e e e
e e e e
e e e
e e
e e e e
e e
e e
+ =

+ + + =
+ +

+
+ +

+
2
2 2 2 2
2 2 2
2 2 2 2 2 2
2 2 2
2 2 2
( )
cos sin
( ) ( )
( ) ( )
sin sin
( ) ( ) ( ) ( )
[( ) ( ) ]
sin sin
( ) ( )
c F
t t
k m c
k m F c F
t t
k m c k m c
k m c F
t F t
k m c
e
e e
e e
e e
e e
e e e e
e e
e e
e e
+ =
+

+ =
+ +
+
=
+

Since a valid equation results, i.e. sin sin F t F t e e = , this means the unique ODE solution is correct.


Harmonically-Forced Underdamped Second-Order System Alternate Solution Form

This harmonically-forced underdamped x(t) solution was derived with the alternate solution form
for the particular solution, i.e. ( ) sin( )
P
x t A t e | = . We can also express the homogeneous solution in
this form as follows.

| |
| |
1 2
( ) cos sin sin( )
sin cos cos sin
n n
n
t t
H d d d H
t
d H d H
x t e B t B t Ce t
Ce t t
e e
e
e e e |
e | e |

= + =
=


Matching terms, we must have

2
1
cos
sin
H
H
C B
C B
|
|
=
=


Solving for the new unknowns C and |
H
:

( ) ( )
2 2 2 2 2 2
2 1
2 2
1 2
cos sin 1 ( )
H H
C C B B
C B B
| | + = = +
= +

1
2
tan
H
B
B
|
(
=
(





199
where we further used the trigonometric identity
2 2
cos sin 1
H H
| | + = . In terms of previous parameters:

2
2 2 2
1 2
2 2 2 2 2 2
2 2
2
2 2 2 2
( sin cos )
( sin )
( sin 2 sin cos cos )
sin
sin ( sin 2 cos ) sin cos
n
d
n n
d
d n n
d
A
C B B A
A
C A
A
C
e | e |
|
e
e | e e | | e |
|
e
e | e | e | e | e |
e
| |
= + = +
|
\ .
+
= +
= + +
1
sin
tan
( sin cos )
sin
tan
sin cos
H
n
d
d
H
n
A
A
|
|
e | e |
e
e |
|
e | e |

(
(

( =

(
(

(
=
(




So the alternate solution form is:

( ) sin( ) sin( )
n
t
d H
x t Ce t A t
e
e | e |

= +



200
Analytical Solution via MATLAB dsolve

As mentioned earlier, MATLAB dsolve can also solve IVP ODEs analytically given
numerical parameter and numerical initial condition values. We will demonstrate this now using the
same four damping cases from the numerical example.

Solve ( ) ( ) ( ) ( ) mx t cx t kx t f t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m, ( ) sin 0.5sin8 f t F t t e t = = , and
zero initial conditions

0
0
(0) 0
(0) 0
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

The MATLAB code below, contained in VibesDsolve.m, shows how to analytically solve
these second-order IVP ODEs using MATLAB function dsolve and display the analytical solution
results to the screen.

%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Anal yt i cal sol ut i on f or t he f or ced second- or der syst em
% ODE usi ng MATLAB f unct i on dsol ve wi t h numer i cal par amet er s.
% Dr . Bob, ME 3012
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cl c; cl ear ;

xa = dsol ve( 10*D2x+98. 696*x=0. 5*si n( 8*pi *t ) , Dx( 0) =0 , x( 0) =0 ) ; %sol ve
xb = dsol ve( 10*D2x+18. 85*Dx+98. 696*x=0. 5*si n( 8*pi *t ) , Dx( 0) =0 , x( 0) =0 ) ;
xc = dsol ve( 10*D2x+20*pi *Dx+10*pi ^2*x=0. 5*si n( 8*pi *t ) , Dx( 0) =0 , x( 0) =0 ) ;
xd = dsol ve( 10*D2x+125. 66*Dx+98. 696*x=0. 5*si n( 8*pi *t ) , Dx( 0) =0 , x( 0) =0 ) ;

XA = vpa( xa, 4) ; %4 di gi t s
XB = vpa( xb, 4) ;
XC = vpa( xc, 4) ;
XD = vpa( xd, 4) ;

pr et t y( XA) %di spl ay
pr et t y( XB)
pr et t y( XC)
pr et t y( XD)


Try this program without the vpa function and you will see why this is necessary.


201
The four dsolve results are given below, compared with known solutions given earlier.

a.
0. 0006430 si n( 3. 141 t ) 0. 00008039 si n( 25. 14 t )

Undamped Solution 0 =

( ) ( ) 0.0000804 8sin sin8 x t t t t t =


b.
0. 0006725 exp( - 0. 9425 t ) si n( 2. 997 t )
- 5 - 5
+ 0. 6089 10 exp( - 0. 9425 t ) cos( 2. 997 t ) 0. 6093 10 cos( 25. 14 t )

- 0. 00007998 si n( 25. 14 t )

Underdamped Solution 0 1 < <

( 0.3 = )
| |
0.94
( ) 0.00000609cos3.00 0.000672sin3.00 0.0000802sin(8 3.07)
t
x t e t t t t

= + +


c.
0. 00001918 exp( - 3. 142 t ) + 0. 001959 exp( - 3. 142 t ) t

- 0. 00001918 cos( 25. 14 t ) 0. 00007550 si n( 25. 14 t )

Critically-damped Solution 1 =
( ) (0.0000192 0.002) 0.0000779sin(8 2.89)
t
x t t e t
t
t

= + +

d.
0. 0001826 exp( - 0. 8410 t ) 0. 0001501 exp( - 11. 72 t ) 0. 00003247
cos( 25. 14 t )

- 0. 00006393 si n( 25. 14 t )

Overdamped Solution 1 >

( 2 = )
0.84 11.72
( ) 0.000183 0.000150 0.000072sin(8 2.67)
t t
x t e e t t

= +

We see that all four dsolve results above are equivalent to their respective known solutions.


202
6.2.2.2 Damped Second-Order System Harmonically-Forced Numerical Examples

Given a translational mechanical Damped Oscillator, assuming zero initial conditions, determine
and plot the time response to the given externally-applied input harmonic forcing function, for four
given damping values c.

Solve ( ) ( ) ( ) ( ) mx t cx t kx t f t + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m, ( ) sin 0.5sin8 f t F t t e t = = , and
zero initial conditions
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =


Given four damping coefficient values c
a. c = 0 N-sec/m undamped
b. c = 18.85 N-sec/m underdamped
c. c = 62.83 N-sec/m critically-damped
d. c = 125.66 N-sec/m overdamped

Solution
We used MATLAB program SecondForce.m. to obtain all plot results in this subsection. For
all four damping cases, the natural frequency e
n
is:
2
0
2
10 rad
10 sec
n
a k
a m
t
e t = = = =


a. Undamped Solution 0 =

this is identical to the Numerical Example presented earlier and
hence the plot is not repeated here. There are two time periods evident in the solution, T
n

based on the natural frequency and T based on the driving frequency.

Characteristic polynomial
2 2
s t +

roots i t

( ) ( ) 0.0000804 8sin sin8 x t t t t t =

2 2
2 sec
n
n
T
t t
e t
= = =

2 2 1
sec
8 4
T
t t
e t
= = =

b. Underdamped Solution 0 1 < <
characteristic polynomial
2 2
1.89 s s t + +

roots 0.94 3.00i

2
18.85
0.3
2
2 100
c
km

t
= = =

2 2
1 1 0.3 3.00 rad/sec
d n
e e t = = =

203
| |
0.94
( ) 0.00000609cos3.00 0.000672sin3.00 0.0000802sin(8 3.07)
t
x t e t t t t

= + +

1 1
2.09 sec
0.48
d
d
T
f
= = =

2 2 1
sec
8 4
T
t t
e t
= = =

As seen in the time response plot below for x(t), two modes of vibration are evident. The
transient response has a larger amplitude and longer time period T
d
. The transient response goes
towards zero given enough time (around 6 sec). The particular solution is superimposed upon this
decaying vibration transient response. It has relatively lower amplitude and faster vibration (shorter
time period T). The particular solution does not decay but remains for as long as the input harmonic
forcing function is applied. At t =0, the initial value is 0 m and the slope is also zero, as specified by
the zero initial conditions.



Harmonically-Forced Underdamped Oscillator Numerical Example x(t) Time Response


204
The next plot shows the same time response x(t), along with the transient (homogeneous) and
steady-state (particular) solutions that superimpose to generate the total solution. This plot more clearly
shows the nature of these solution components that were discussed above. The transient and steady-state
solutions appear to start from zero, but they start from very small numbers (6.0915e-006 and 6.0915e-
006), negative of each other to provide the overall zero initial position. This plot also shows more
clearly that the steady-state solution has converged to the total solution by t =6 sec (i.e. the transient
solution is nearly zero by this point in time).




Same x(t) Time Response showing Transient and Steady-State Components


205
Below we plot the same total x(t) response for the same example as the above two plots, along
with its first and second derivatives (different color scheme than the previous page). These three plots
are arranged separately on a subplot since their magnitudes are greatly different; the acceleration is the
largest, then the velocity, and the position magnitudes are the smallest. We see that the acceleration
reaches steady-state before the velocity, which reaches steady-state before the position. We see both
initial conditions, i.e. zero initial position and zero initial velocity. It turns out that the initial
acceleration is also zero, though this is not specified since it is only a second-order problem. What are
the relationships amongst these plots, from Calculus?




Same Underdamped Numerical Example with Position Velocity, and Acceleration


206
Now we plot the same response for the same example as the above three plots, this time showing
the ( ) x t vs. x(t) phase plot. To emphasize the steady-state behavior (vibratory response to the harmonic
forcing function), the plot below includes time up to 20 sec, instead of 6 sec as before. How do we
interpret this complicated graph? Where is time on this graph?



Same Underdamped Numerical Example, Phase Plot


Let us repeat the above underdamped numerical example, changing only the driving frequency
e.
( ) sin 0.5sin
2
f t F t t
t
e = =


The associated driven-mode time period T is 16x longer.

2 2
4 sec
2
T
t t
t
e
= = =


207
The new x(t) time response is plotted below.



Second Harmonically-Forced Underdamped Example x(t) Time Response with Lower e


The natural frequency e
n
is unchanged and the new second-order response x(t) is:

2
10 rad
10 sec
n
t
e t = =


| |
0.94
( ) 0.0023cos3.00 0.0023sin3.00 0.0063sin( 0.38)
2
t
x t e t t t
t

= +


Again the total response is the superposition of the two modes of vibration. But this time the
dominant mode is the driving mode, with T =4 sec and a larger amplitude, upon which is superimposed
the decaying damped mode with the same time period T
d
=2.09 sec as before, and a relatively-lower
amplitude (less than half). Again, this combined periodic response oscillates theoretically forever, as
long as the input force is applied. The transient term dies out, but the steady-state solution continues.
At t =0, the initial value is 0 m and the slope is also zero, as specified by the zero initial conditions.

The two plots below show the same second underdamped system harmonically-forced example,
first the position, velocity, and acceleration and second the phase plot.

208

Second Underdamped Numerical Example with Position Velocity, and Acceleration


Second Underdamped Numerical Example, Phase Plot (t = 40 sec)

209
c. Critically-damped Solution 1 =
characteristic polynomial
2 2
2 s s t t + +

roots , t t

2
62.83
1
2
2 100
c
km

t
= = =

( ) (0.0000192 0.002) 0.0000779sin(8 2.89)
t
x t t e t
t
t

= + +

2 2 1
sec
8 4
T
t t
e t
= = =

As seen in the time response plot below for the total x(t), one steady-state mode of vibration is
superimposed onto the non-oscillatory critically-damped transient response. We see that the transient
response disappears (the total solution approaches the steady-state solution) by around 3 sec. The
particular solution remains for as long as the input harmonic forcing function is applied. At t =0, the
initial value is 0 m and the slope is also zero, as specified by the zero initial conditions.


Harmonically-Forced Critically-Damped Numerical Example x(t) Time Response


210
Below we plot the same x(t) response for the same example as the above plot, along with its first
and second derivatives. These three are arranged separately on a subplot since their magnitudes are
greatly different; the acceleration is the largest, then the velocity, and the position magnitudes are the
smallest. We see that the acceleration reaches steady-state before the velocity, which reaches steady-
state before the position. We see both initial conditions, i.e. zero initial position and velocity. It also
turns out that the initial acceleration is zero, though this is not specified since it is only a second-order
problem. What are the relationships amongst these plots, from Calculus?




Same Critically-Damped Numerical Example with Position Velocity, and Acceleration



211
Now we plot the same response for the same example as the above two plots, this time showing
the ( ) x t vs. x(t) phase plot. To emphasize the steady-state behavior (vibratory response to the harmonic
forcing function), the plot below includes time up to 20 sec, instead of 6 sec as before. How do we
interpret this complicated graph? Where is time on this graph?




Same Critically-Damped Numerical Example, Phase Plot



212
Let us repeat the above critically-damped numerical example, only changing the driving
frequency e, with associated driven time period T 16x longer.
( ) sin 0.5sin
2
f t F t t
t
e = =
2 2
4 sec
2
T
t t
t
e
= = =
The new time response is plotted below.


Harmonically-Forced Critically-Damped Example x(t) Time Response with Lower e


The natural frequency e
n
is unchanged and the new second-order response x(t) is:

2
10 rad
10 sec
n
t
e t = =

( ) (0.0032 0.0064) 0.0041sin( 0.93)
2
t
x t t e t
t
t

= + +

Again in the total time response x(t), one steady-state mode of vibration is superimposed onto the
non-oscillatory critically-damped transient response. We see that the transient response again
disappears (the total solution approaches the steady-state solution) by around 3 sec. The particular
solution remains for as long as the input harmonic forcing function is applied. At t =0, the initial value
is 0 m and the slope is also zero, as specified by the zero initial conditions.

The two plots below show the same second critically-damped system harmonically-forced
example, first the position, velocity, and acceleration and second the phase plot.

213

Second Critically-Damped Numerical Example with Position Velocity, and Acceleration


Second Critically-Damped Numerical Example, Phase Plot (t = 40 sec)

214
d. Overdamped Solution 1 >
characteristic polynomial
2 2
12.57 s s t + +

roots 0.84, 11.73

2
125.66
2
2
2 100
c
km

t
= = =

0.84 11.72
( ) 0.000183 0.000150 0.000072sin(8 2.67)
t t
x t e e t t

= +


2 2 1
sec
8 4
T
t t
e t
= = =


As seen in the time response plot below for the total x(t), one steady-state mode of vibration is
superimposed onto the non-oscillatory overdamped transient response. We see that the transient
response disappears (the total solution approaches the steady-state solution) by around 6 sec, slower than
the critically-damped case. The particular solution remains for as long as the input harmonic forcing
function is applied. At t =0, the initial value is 0 m and the slope is also zero, as specified by the zero
initial conditions.




Harmonically-Forced Overdamped Numerical Example x(t) Time Response


215
Below we plot the same x(t) response for the same example as the above plot, along with its first
and second derivatives. These three are arranged separately on a subplot since their magnitudes are
greatly different; the acceleration is the largest, then the velocity, and the position magnitudes are the
smallest. We see that the acceleration reaches steady-state before the velocity, which reaches steady-
state before the position. We see both initial conditions, i.e. zero initial position and velocity. What are
the relationships amongst these plots, from Calculus?



Same Overdamped Numerical Example with Position Velocity, and Acceleration



216
Now we plot the same response for the same example as the above two plots, this time showing
the ( ) x t vs. x(t) phase plot. To emphasize the steady-state behavior (vibratory response to the harmonic
forcing function), the plot below includes time up to 20 sec, instead of 6 sec as before. How do we
interpret this complicated graph? Where is time on this graph?



Same Overdamped Numerical Example, Phase Plot



217
Let us repeat the above critically-damped numerical example, only changing the driving
frequency e, with associated driven time period T 16x longer.
( ) sin 0.5sin
2
f t F t t
t
e = =
2 2
4 sec
2
T
t t
t
e
= = =

The new time response is plotted below.


Harmonically-Forced Overdamped Example x(t) Time Response with Lower e

The natural frequency e
n
is unchanged and the new second-order response x(t) is:

2
10 rad
10 sec
n
t
e t = =

0.84 11.72
( ) 0.000183 0.000150 0.000072sin(8 2.67)
t t
x t e e t t

= +

Again in the total time response x(t), one steady-state mode of vibration is superimposed onto the
non-oscillatory critically-damped transient response. We see that the transient response again
disappears (the total solution approaches the steady-state solution) by around 7 sec. The particular
solution remains for as long as the input harmonic forcing function is applied. At t =0, the initial value
is 0 m and the slope is also zero, as specified by the zero initial conditions.

The two plots below show the same second critically-damped system harmonically-forced
example, first the position, velocity, and acceleration and second the phase plot.

218

Second Overdamped Numerical Example with Position Velocity, and Acceleration


Second Overdamped Numerical Example, Phase Plot (t = 40 sec)

219
6.2.2.3 Damped Second-Order Harmonically-Forced Numerical ODE Solutions
Numerical Solution via MATLAB function ode45
Given the same harmonically-forced damped translational mechanical m-c-k systems from the
previous numerical examples, find the solution numerically using MATLAB function ode45. This
function implements the fourth/fifth-order Runge-Kutta numerical solution for ODEs.

Solve ( ) ( ) ( ) ( ) mx t cx t kx t f t + + = for x(t)

Given m =10 kg, c (the four values for different damping conditions), k =10t
2
N/m,
( ) sin 0.5sin8 f t F t t e t = = , and zero initial conditions.
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =

Usage
[tout,yout] = ode45(odefun,tspan,Y0);
odefun is a function handle to the function containing the ODE right-hand-side.
Tspan = [t0 tfinal] is the time span
Y0 array of initial conditions on Y.

MATLAB function ode45 integrates the system of differential equations y = f(t,y) from time
t0 to tfinal with initial conditions Y0.
So we must first express the ODE in the MATLAB-accepted form y = f(t,y), i.e. convert
the single second-order ODE into two first-order ODEs. Define:
1
2 1
2 1
( ) ( )
( ) ( ) ( )
( ) ( ) ( )
x t x t
x t x t x t
x t x t x t
=
= =
= =



1 2
2 1 2
( ) ( )
( ) ( ) ( ) sin
x t x t
k c F
x t x t x t t
m m m
e
=
= +



Here is MATLAB m-file OdeToE452.m to solve the harmonically-forced second-order ODE
numerical examples using MATLAB function ode45.

clear; clc;
[t,x] = ode45(@SecundForc,[0 6],[0 0]); % (fn name, t range, X0)
figure; plot(t,x(:,1)); grid;

The function containing the ODE RHS is given below. This function SecundForc.m must be in the
MATLAB search path.

function dx = SecundForc(t,x)
m = 10; c = 18.55; k = 10*pi^2; F = 0.5; w = 8*pi; % underdamped
dx = zeros(2,1); % a column vector
dx(1) = x(2);
dx(2) = -(k/m)*x(1) + -(c/m)*x(2) + F*sin(w*t)/m;

The plots generated by this MATLAB m-file for each of the four c values are identical to those
presented earlier in the numerical example, so they are not repeated here. The same is true for
( ) 0.5sin( /2) f t t t = .

220
Numerical Solution via MATLAB function lsim
Given the same translational mechanical Damped Oscillator from the previous numerical
examples, find the solution numerically using MATLAB function lsim. The state-space matrices for
this system were previously derived.

0 1
k c
m m
(
(
=
(


A
0
1
m
(
(
=
(

B
| |
1 0 = C
| |
0 = D

Given a translational mechanical Damped Oscillator, with applied input force ( ) sin f t F t e = ,
determine and plot the time response x(t), for four given damping values c.

Solve ( ) ( ) ( ) sin mx t cx t kx t F t e + + = for x(t)

Given m =10 kg, c N-sec/m (see below), k =10t
2
N/m and zero initial conditions
0
0
(0) 0 m
(0) 0 m/s
x x
x v
= =
= =


Given four damping coefficient values c:
a. c = 0 N-sec/m
b. c = 18.85 N-sec/m
c. c = 62.83 N-sec/m
d. c = 125.66 N-sec/m

Here is a MATLAB m-file to solve the SHM numerical example using MATLAB function lsim.

clc; clear;
m = 10; k = 10*pi^2; ca = 0; cb = 18.85; cc = 62.83; cd = 125.66;
% state space for use with MATLAB function lsim
F = 0.5; w = 8*pi; f = F*sin(w*t); % given forcing function
t = [0:0.01:6]; % time array
B = [0; 1/m]; C = [1 0]; D = [0]; % common BCD matrices
% define undamped state-space model and solve IVP
Aa = [0 1;-k/m ca/m]; mcka = ss(Aa,B,C,D); [ya,ta,xa] = lsim(mcka,f,t);
% define underdamped state-space model and solve IVP
Ab = [0 1;-k/m cb/m]; mckb = ss(Ab,B,C,D); [yb,tb,xb] = lsim(mckb,f,t);
% define critically-damped state-space model and solve IVP
Ac = [0 1;-k/m cc/m]; mckc = ss(Ac,B,C,D); [yc,tc,xc] = lsim(mckc,f,t);
% define overdamped state-space model and solve IVP
Ad = [0 1;-k/m cd/m]; mckd = ss(Ad,B,C,D); [yd,td,xd] = lsim(mckd,f,t);

figure;
plot(ta,ya,k,tb,yb,r,tc,yc,g,td,yd,b); grid; axis([0 6 -0.015 0.015]);
set(gca,FontSize,18);
legend(undamped,underdamped,critically-damped,overdamped);
xlabel({\ittime} ({\itsec})); ylabel({\itx(t)} from lsim ({\itm}));

The curves generated by this MATLAB m-file, contained in SecondForce.m, are identical to
those presented earlier in the numerical example, so they are not repeated here.

221
Numerical Solution via MATLAB / Simulink

We can solve the forced response to the given input sine wave and zero initial conditions for the
same series of second-order ODEs (undamped, underdamped, critically-damped, and overdamped) using
MATLABs GUI Simulink. From the MATLAB command window type simulink and you can
create and simulate any dynamic system described by ODEs, including vibratory systems. J ust like
MATLAB function lsim, we can enter a dynamic system into Simulink via the state-space matrices
given previously for this series of examples.

The Simulink diagram below, SecondForc.mdl, was created to solve this same series of
second-order forced time responses to the given harmonic input. As shown, all four second-order
systems (differing only in the amount of damping) can be fed by the same input sine wave. This time all
four time responses are plotted on separate scopes, since we did not compare all four on the same plot
earlier.


Simulink Model to Solve Second-Order ODE Free Responses

We used a Sine Wave input and double-clicked on it to enter 0.5 amplitude and a driving
frequency of 8t. We had the proper State-Space blocks with the four sets of matrices ABCD from the
free (unforced) numerical Simulink example presented earlier. Be sure to also enter the zero initial
conditions [0 0] here. We entered 6.0 in the final time dialog window at the top and then just pressed
the play button. Double-clicking on each scope will then display the simulation results for that damping
case. The resulting plots are identical to those shown previously (though the Simulink graphics do not
look as nice), so they are not repeated here. We repeated this simulation for a driving frequency of t / 2
and a final time of 8.0 sec and also got the identical results as previously.


222
6.2.2.4 Damped Resonance

Vibrational resonance is defined as the vibratory amplitude increase in an engineering electrical
or mechanical system excited by an external input periodic force whose driving frequency is equal or
close to the systems natural frequency. We had an introduction to this topic in the undamped
harmonically-forced section and more information is presented in the current section. Here is an xkcd
comic to introduce the topic of resonance in vibrations.


xkcd.com

As another practical example, pushing a child on a swing higher and higher is easier when the
external input force of excitation (your pushing) is at the same frequency as the natural frequency of this
pendulum system. You neednt apply excessive force, just time your force inputs to the pendulum
natural frequency, to increase the amplitude of swinging.

Other examples of desired uses of mechanical resonance are in high-quality musical instruments
and breaking a wine glass by a note sung at the correct frequency. Crossing a flexible cable bridge can
be fun if you are the source of the resonant excitation force, or scary if you are the innocent mass simply
trying to cross safely.

As we stated before, resonance in vibrational systems is a potentially big problem. When the
driving frequency e of the input forcing function is the same as, or close to, the natural frequency e
n
of
the system, the resulting amplitude of the steady-state vibration becomes very large. Some systems may
be able to harness resonance for good, but generally resonance is something to avoid since it could
damage the system or environment.

The catastrophic destruction of the Tacoma Narrows Bridge in 1940 (Galloping Gertie) is often
put forth as an example of mechanical resonance. Certainly resonance contributed, but, according to
Wikipedia, aeroelastic flutter is now thought as the primary destructive mechanism for that famous
example. Understanding, avoiding, and/or isolating a structure from earthquakes, wind loading, or other
planned or unplanned loading is a major effort in large construction projects.

For the harmonically-forced second-order damped vibrational m-c-k model:

( ) ( ) ( ) sin mx t cx t kx t F t e + + =


223
Recall that the steady-state solution is:

( ) sin( )
P
x t A t e | =

where the amplitude A and phase angle | are:

2 2 2
( ) ( )
F
A
k m c e e
=
+


1
2
tan
c
k m
e
|
e

(
=
(




Defining r to be the ratio of the driving frequency to the natural frequency, these terms can be
genericized by dividing the numerator and denominator of A by the spring constant k. This was done in
detail at the end of the particular solution earlier and the results are summarized below.

n
r
e
e
=

2
c
km
=


2 2 2
(1 ) (2 )
F k
A
r r
=
+

1
2
2
tan
1
r
r

|

(
=
(




Plotting the resulting steady-state vibrational amplitude and phase angle is called the frequency
response of the system. This demonstrates graphically what happens to the amplitude and phase angle
of vibration as the driving frequency e changes (relative to the natural frequency). Let us plot the
normalized amplitude M and the phase angle | vs. the dimensionless frequency ratio r.

2 2 2
1
(1 ) (2 )
A
M
F k
r r
= =
+


M stands for the amplitude magnification factor, i.e. the calculated amplitude of vibration A compared to
the generic F / k input magnitude. M is unitless, e.g. length / length for the translational mechanical
system.

224

Damped Frequency Response: Amplitude vs. r

We see above in the M vs. r part of the frequency response plot that, for the undamped case =
0, the maximum M peak is infinite, at r =1. The peak M values occur before r =1 for the damped cases.
The peaks disappear for =0.707 and higher damping cases.

All plots in this subsection were generated using MATLAB file Resonance.m.

In the | vs. r part of the frequency response plot below, for the undamped case =0, the phase
angle shifts from 0 to 180

to account for the change in sign for M at r =1, as previously discussed. As


damping increases, this sharp shape is rounded more and more until, at =0.707, the initial part of the |
curve loses its concavity. All curves pass through 90

at r =1.
225

Damped Frequency Response: Phase Angle | vs. r

For sample time responses, see the last three pages of this subsection.
To analyze the normalized amplitude M behavior discussed above, we take the derivative of M
with respect to r, to find the location of the M function extrema.
2 2
3
2 2 2
2
2 (1 2 )
(1 ) (2 )
dM r r
dr
r r


=
( +



dM/dr vs. r

226
The above plot shows the r derivative of M plotted vs. r, for the same cases as before. We
focus on the zero crossings in the above graphical result.
To find the maximum amplification value M
max
for each dimensionless damping ratio , we set
0
dM
dr
= , which yields
2 2
(1 2 ) 0 r r =

whose solution is:
2
1 2 r = This point on each M vs. r curve gives the maximum peak, as long as
12 0.707 < = (otherwise an imaginary number would result). For 0.707 >
no peak exists.

r =0 The initial point on each M vs. r curve is a local minimum for 0.707 < ; for
0.707 > it is a maximum point since there is no peak in those cases, as stated
above.

r = The final point on each M vs. r curve is the global minimum for all cases.


2
max
1 2 r = vs.

The above plot shows the values of r (
2
max
1 2 r = ) for which the maximum peak values of M
are achieved in the damped frequency response. For 0.707 > no peak exists since
2
max
1 2 r = is
imaginary, as stated above. Also as stated earlier, the location of the maximum peak M for no damping
is r =1; this is the undamped resonant case with M .

227
To evaluate the maximum peak values for M for the various damping values, substitute
2
max
1 2 r = into M.
2
max max
2 2 2 2
max
4 2 4 2 2 2
1
( 1 2 )
(1 (1 2 )) 4 (1 2 )
1 1 1
4 4 8 4 (1 ) 2 1
M M r
M



= = =
+
= = =
+


This result is valid only for 0 0.707 s s , including for =0, whose maximum resonant peak
value is infinite, and also for =0.707, whose maximum peak value is M =1.0 at r =0.
In the above M
max
result it is convenient to express it instead in terms of maximum r,
2
max
1 2 r = , that is the r value leading to the maximum peak value for each case.
2
max
2
1 2
1
2
r
r

=

max
2 2 2
max
4 2 2
2 2
1 1
2 1 1 1
2 1
2 2
1 1 1
2
1 1 1
(1 )(1 )
2
4
2 2
M
r r
M
r r r
r r

= =

= = =
| || | +
+
| |
\ .\ .


Plotting this M
max
curve vs. r will intersect all the maximum peak values for all cases. Let us
demonstrate by re-plotting the normalized amplitude M portion of the previous frequency response, this
time with M
max
and finer resolution over the range that has peaks, 0 0.707 s < .


Maximum Peak Amplitude vs. r

228
The frequency response plots (magnitude and phase angle vs. dimensionless frequency ratio r)
presented in the Damped Resonance subsection above do not show the effect of r on the vibratory time
response. Therefore, we present this on the current page.
Given m =10 kg, k =10t
2
N/m, ( ) 0.5sin f t t e = , and zero initial conditions, the subplots below
give the time response for various values of
n
r e e = , given in the r values in the legend table below,
for the three values shown in the plot legend (all underdamped).



Damped Resonance Example Sample Time Responses Total Solution

r =0.01 r =0.1
r =0.5 r =1
r =2 r =3

All plots have the same horizontal time scale and the same vertical displacement scale for easy
comparison (except for the vertical scale of the resonant case, which is 3x bigger than all other plots).
The r =1 case was the resonant case for zero damping; since there is damping we no longer need to use
r =0.9999 in MATLAB for successful numerical simulation as in the undamped case. Due to damping,
the amplitude no longer goes to , but the worst amplitude (for =0.1) is 0.0253 .
For r <1 we see that the vibratory solution displacement amplitude increases as r increases and
for r >1 we see that the vibratory solution displacement amplitude decreases as r increases. Also, the
higher the damping is, the lower the vibratory motion amplitudes are.

0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
x
(
t
)

(
m
)
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01


=0.1
=0.4
=0.707
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
x
(
t
)

(
m
)
0 5 10 15 20
-0.02
0
0.02
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
time (sec)
x
(
t
)

(
m
)
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
time (sec)
229
The vibratory time responses presented on the previous page are the total response x(t). For
clarity this page presents the same vibratory time responses, but for the particular solution only.



Damped Resonance Example Sample Time Responses Particular Solution

r =0.01 r =0.1
r =0.5 r =1
r =2 r =3

For r <1 we see that the vibratory solution displacement amplitude increases as r increases and
the frequency of vibration also increases. For r >1 we see that the vibratory solution displacement
amplitude decreases as r increases, while the frequency of vibration still increases. Also, for r <1 we
see that the phase angle is zero, while for r >1 the phase angle is 180 deg.


0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
x
(
t
)

(
m
)
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01


=0.1
=0.4
=0.707
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
x
(
t
)

(
m
)
0 5 10 15 20
-0.02
0
0.02
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
time (sec)
x
(
t
)

(
m
)
0 5 10 15 20
-0.01
-0.005
0
0.005
0.01
time (sec)
230
On the previous two pages, the x(t) responses shown for the r =1 case are not the resonant cases.
As derived in the ME 3012 NotesBook, with damping included, the resonant peaks occur for r <1. The
maximum magnitude amplification factor M occurs for
2
1 2 r = . For dimensionless damping ratios
of =0.1, 0.4, and 0.707, these resonant r values are r =0.990, 0.825, and 0, respectively. The figure
below shows the x(t) particular solution responses for the damped resonant cases. Since =0.707 has
no resonant peak, we instead show =0.7, with r =0.141.




Damped Resonant Cases Time Responses: Particular Solution

All of these damped resonant amplitudes are somewhat higher than the previously-shown r =1
cases.


0 2 4 6 8 10 12 14 16 18 20
-0.03
-0.02
-0.01
0
0.01
0.02
0.03
time (sec)
x
(
t
)

(
m
)


=0.1, r =0.990
=0.4, r =0.825
=0.7, r =0.141
231
6.2.2.5 Transmissibility

An important topic in vibrations and machine design is vibration isolation. For a given
machine, designers specify the mountings (combinations of springs and dashpots) to reduce the shaking
forces and moments on the ground as much as possible. Passive vibration isolation indicates using fixed
components for isolation. Active vibration isolation requires sensors, a processor, actuation, and control
theory, which is much more complicated, but with potential improvements in vibration isolation
compared to the passive case.

Transmissibility is defined as the ratio of the maximum force transmitted to the base over the
maximum input force magnitude and is thus unitless or can be expressed as a percentage. In a good
vibration isolation system, the transmissibility should be low, much less than 1.

Consider the standard forced m-c-k system. Recall from the section on resonance that the
maximum normalized amplitude M is:

2 2 2
1
(1 ) (2 )
A
M
F k
r r
= =
+

n
r
e
e
=

where A is the amplitude of vibration, F is the input sinusoidal force magnitude, and k is the spring
constant. In this system the ground force is transmitted through the spring and dashpot elements. Recall
that the spring and dashpot forces are ( )
S
f kx t = and ( )
D
f cx t = . Further recall that the velocity ( ) x t

always leads the position x(t) by 90

. Therefore the total maximum transmitted force F


t
is:

( )
2
2
2
2 2
2
( ) ( ) 1 1 1 2
t
n
c
F kA cA kA kA kA r
k
e e
e
e
| |
| |
= + = + = + = +
| |
\ .
\ .


And the transmissibility TR is the ratio of F
t
over F.

( )
2
2 2 2
2
2 2 2
1 2
(1 ) (2 )
1 (2 )
(1 ) (2 )
t
kA r
F
TR
F
kA r r
r
TR
r r

+
= =
+
+
=
+


Note that this TR result has the same denominator as the M ratio from the resonance discussion, but a
different numerator. Below we plot TR vs. frequency ratio r, for various values.

232

Transmissibility vs. r

We see all curves pass through the same ratio point of 1 at r =0 and 2 r = . From these
graphical results we see that the designer must keep the frequency ratio r as large as possible and the
damping as small as possible to achieve low transmissibility 1 TR .

MATLAB file Transmiss.m was used to generate the above curves.

The vibrational model for a second-order m-c-k system with input displacement u(t) instead of
input external force f(t) is:

( ) ( ) ( ) ( ) ( ) mx t cx t kx t cu t ku t + + = +

Due to the similarity of these models, the transmissibility
X
TR
U
= is identical to the transmissibility
t
F
TR
F
= and so the above plot covers the displacement input case also, with the same design
conclusions.


233
6.2.2.6 Rotating Imbalance
The model for a machine with a rotating imbalance is shown below.





2
2 1
( ) ( ) ( ) sin m x t cx t kx t me t e e + + =

where the unbalanced mass is m
1
, the total machine mass is m
2
, e is the effective offset length of the
imbalance, and the equivalent spring and damping coefficients connecting the machine to ground are k
and c, respectively. Following the same method we used for deriving the resonance plots we obtain the
dimensionless ratio E expressing the machine motion relative to the unbalanced motion.
2
2
2 2 2
1 (1 ) (2 )
m A r
E
me
r r
= =
+


This E relationship is plotted below vs. frequency ratio r, for various values.

Unbalanced motion ratio vs. r

m
1
m
2
k c
x(t)
e
t e
234
At first this series of plots resembles the resonance plots from before. Two main differences are that the
peaks in E ratios for the various values are to the right of r =1, rather than to the left, and the final
value asymptote is 1 rather than 0. This means that the machine vibration approaches that of the rotating
imbalance as r increases. Again, r values near resonance are to be avoided due to high output motion.

The transmissibility results for this rotating imbalance case are different than for the two cases
presented previously in the last section. The transmissibility in this case is defined as the force
transmitted to ground through the springs and dashpots, relative to the normalized unbalanced mass.
2 2
2 2 2
1 2
1 (2 )
(1 ) (2 )
t
U
r r F k
TR
me m
r r

+
= =
+


This TR
U
relationship is plotted below vs. frequency ratio r, for various values.

Unbalanced transmissibility TR
U
vs. r

We see all curves pass through the same transmissibility point of 2 at 2 r = . Again, we
desire very low values of transmissibility in the rotating unbalance case, that is we want 1
U
TR . In
the TR
U
plots above we see that all cases will yield 1
U
TR > , some even yield 1
U
TR . For all r
values greater than 1, (and for many r values less than 1), higher damping causes higher transmissibility,
which is undesirable. The best way to limit transmissibility in this case is to minimize the rotating
imbalance
1
m e by balancing the rotating shaft.

MATLAB file Transmiss.m was used to generate the above two plots.

235
6.2.3 General Forcing Functions

In the previous section we considered only periodic harmonic input forcing of the form

( ) sin f t F t e =

We could have equally considered periodic harmonic input forcing of the form ( ) cos f t F t e = . All
derived results would be very similar so we neednt repeat our derivations for the cosine input function.

This section discusses more general input functions for forced vibrations of dynamic systems.
We consider both periodic and non-periodic general input forcing functions. These topics used to be
central in learning classical vibrations, but, with the advent of MATLAB/Simulink, these types of
general input functions are easy to represent using computer simulation. These simulations are much
more accurate and far easier to perform than earlier in history.


6.2.3.1 Periodic Forcing Functions

Periodic forcing functions used as external inputs to vibratory systems have classically been
represented by the Fourier series. Any periodic forcing function f(t) with a time period of 2 T t e = can
be represented by an infinite Fourier series.

0
1 1
( ) cos sin
2
p p
p p
a
f t a p t b p t e e

= =
= + +



where
0
2
( )cos
T
p
a f t p tdt
T
e =
}
0,1,2, p =

0
2
( )sin
T
p
b f t p tdt
T
e =
}
1,2, p =

It is up to the engineer to decide how many p terms to include in the series to obtain the desired fidelity
and accuracy.

An alternate form for the Fourier series, suitable for the frequency response, is obtained by using
a familiar transformation (sine sum-of-angles formula); the result is:

( )
0
1
( ) sin
p p
p
f t A A p t e |

=
= + +



where
0
0
2
a
A =

2 2
p p p
A a b = +

1
tan
p
p
p
a
b
|

(
=
(
(



236
Fourier Series Examples

1. Square Wave. Represent the f(t) square wave below by using a Fourier series. The time period
in this example is 2 T t = sec (thus 2 1 T e t = = rad/sec) and this input repeats periodically as
long as desired. The discontinuous square wave function f(t) is:

( ) 1 f t =

0 t t < <

( ) 1 f t =

2 t t t < <

Solution.
Evaluating the Fourier series coefficients for this given square-wave and given time period T, we
find the following coefficients.

0
p
a =

0,1,2, p =
4
p
b
pt
=

1,3,5, p=
0
p
b =

2,4,6, p =

Therefore, the square-wave solution is:

4 sin sin3 sin5
( )
1 3 5
t t t
f t
t
| |
= + + +
|
\ .


The fundamental frequency of a periodic function such as this result is:

2 2 rad
1
2 sec T
t t
e
t
= = =

and the harmonic frequencies of a periodic function, the components contributing to the Fourier series,
are:

2 2 rad
2 sec
p
p p
p
T
t t
e
t
= = =

1,3,5, p =

Any guitar player knows that harmonic frequencies are integer multiples of the fundamental
frequency for each string.

As shown above, only the odd sine terms are non-zero in the Fourier series for the square wave.
The subplots below show the Fourier series approximation for the given square wave, for p =1, 7, 13,
19.

237

Fourier Series Approximation of a Square Wave

We see that higher p values represent the discontinuous square wave more faithfully. However,
the harmonic frequencies increase, though with relatively low amplitude, as p increases. Also, the
amount of overshoot shown for p =19 is no longer decreasing for higher p.

It is pretty cool to animate this in MATLAB demonstrate this using MATLAB file
FourierSeries.m.



2. Saw-Tooth Wave. Represent the f(t) saw-tooth wave below by using a Fourier series. The time
period in this example is again 2 T t = sec (thus 2 1 T e t = = rad/sec) and this input repeats
periodically as long as desired. The discontinuous saw-tooth wave function f(t) is:

( ) f t t =

0 t t < <

( ) 2 f t t t =

2 t t t < <

Solution
Evaluating the Fourier series coefficients for this given saw-tooth wave and given time period T,
we find the following coefficients.
238

0
p
a =

0,1,2, p =
1
2( 1)
p
p
b
p
+

=

1,2,3,4, p =

Therefore, the saw-tooth wave solution is:

sin sin2 sin3 sin4
( ) 2
1 2 3 4
t t t t
f t
| |
= + +
|
\ .


The fundamental and harmonic frequencies for this example are:

2 2 rad
1
2 sec T
t t
e
t
= = =

2 2 rad
2 sec
p
p p
p
T
t t
e
t
= = =

1,2,3,4, p =

As shown above, only the sine terms are non-zero in the Fourier series for the saw-tooth wave, in
this case, all p terms (not just the odds as in the square wave). The subplots below show the Fourier
series approximation for the given saw-tooth wave, for p =1, 4, 7, 10.


Fourier Series Approximation of a Saw-Tooth Wave
239

We see again that higher p values represent the discontinuous saw-tooth wave more faithfully.
However, the harmonic frequencies increase as p increases. Also, the amount of overshoot increases for
increasing p. These plots were generated using MATLAB file FourierSeriesSaw.m.

Fourier Series Frequency Spectrum

We can also represent Fourier Series example results using a frequency spectrum. That is, we
can plot the amplitude A of each Fourier Series component vs. p, the frequency counter for each term.
Remember p = 1 is associated with the fundamental frequency e, and p > 1 are the harmonic
frequencies, where p is always an integer. The frequency spectrum plots are given below for the square-
and saw-tooth wave examples from before.


Amplitude A(p) vs. Frequency Counter p for the Square Wave

Remember for the square wave that only the odd sine terms were active. The plot above shows the
Fourier Series amplitude for each component in the square wave approximation, up to p =19. The curve
gives the amplitude formula, 4 pt , but it is only in effect for the odd integer p values.

240

Amplitude A(p) vs. Frequency Counter p for the Saw-Tooth Wave

Remember for the saw-tooth wave that only the sine terms were active, this time odds and evens for p.
The plot above shows the Fourier Series amplitude for each component in the saw-tooth wave
approximation, up to p =10. The curve gives the amplitude formula, 2 p , but it is only in effect for the
integer p values. Note that the amplitudes A(p) above are shown to be positive only; in the saw-tooth
Fourier Series approximation, all the even terms are negative.
These two plots were generated using MATLAB files FourierSeries.m. and
FourierSeriesSaw.m, respectively.
The 3D plot below shows a diagram to better explain the relationships amongst amplitude, time,
and frequency in sinusoidal functions.













Amplitude A vs. time t vs. frequency e diagram

241
Fourier Series Forcing Function

The model for a standard m-c-k system with a general input periodic forcing function is:

0
1 1
( ) ( ) ( ) ( ) cos sin
2
p p
p p
a
mx t cx t kx t f t a p t b p t e e

= =
+ + = = + +



Classically, this problem can be solved by utilizing linear superposition, i.e. solving this linear second-
order ODE separately for each of the three forcing terms above, and then adding the three solutions to
obtain the overall solution. In this section, instead, we will use MATLAB/Simulink to solve some
example numerical problems with periodic forcing functions.

Example 1
Solve the following ODEs given that u(t) is a periodic square pulse wave of time period 4 sec,
with a value of 1 for half the cycle and a value of zero for the second half of the cycle (see the yellow
curve below).

a. ( ) 5 ( ) 5 ( ) x t x t u t + =

b. ( ) ( ) ( ) x t x t u t + =


As presented earlier, to communicate a system to MATLABs Simulink, we must use state space
matrices. For a first order system, all state-space matrices are scalars:

a. | | | | | | | |
5 5 1 0 = = = = A B C D


b. | | | | | | | |
1 1 1 0 = = = = A B C D


The Simulink model SquareInput.mdl to simulate the time responses of these two systems
to the given square wave pulse is shown below. The Simulink time response plots are shown next.


Simulink model for first-order systems square pulse time responses
242


Input Square Wave First-order Response a. First-order Response b.

For case a. the time constant is t =0.2 sec and we see the square wave pulse response does have
time to reach its steady-state value of 1 before the pulse magnitude switches. For case b. the time
constant is t =1 sec and we see the square wave pulse response does not have sufficient time to reach its
steady-state value of 1 before the pulse magnitude switches.


Example 2
Re-solve the case a. ODE from Example 1, given that u(t) is a periodic triangular saw wave of
time period 4 sec, with a value of u(t) =t for the cycle and a discontinuity leading to the next cycle (see
the yellow curve below).

The Simulink model SawInput.mdl to simulate the time responses of this first-order system
a. to the given saw-tooth wave is shown below. The Simulink time response plots are shown next.


Simulink model for first-order system saw-tooth wave time response

243


Input Saw Wave First-order Response a.

We see that now case a. cannot keep up with the input triangular wave. There is time lag in the response
and the magnitudes do not reach the desired values either at the maximum or minimum saw-tooth
points.


6.2.3.2 Non-periodic Forcing Functions

Non-periodic (aperiodic) input forcing function inputs can readily be handled in
MATLAB/Simulink simulation and hence are not covered here. Standard aperiodic input functions such
as the unit impulse (Dirac delta), unit step, and unit ramp inputs are a major focus of the Controls we
presented in the first part of this semester.


244
7. Hardware Control in the Ohio University Robotics Lab

7.1 Quanser/Simulink Controller Architecture

Quanser/Simulink Controller Diagram




Quanser/Simulink Controller Hardware



External I/O Board Power Supply


245
Controlled via Quanser/Simulink



Inverted Pendulum
246
Controlled via Quanser/Simulink (continued)



8-axis NASA ARMII (Advanced Research Manipulator II)




SPAM (SPherically-Actuated platform Manipulator)
247
Controlled via Quanser/Simulink (continued)



4-dof GPS/IMU Calibration Platform




3-dof Planar 3-RPR Parallel Robot
248
Controlled via Quanser/Simulink (continued)



6-dof Spatial 6-PSU Platform




RoboCup Player Cable-Suspended Haptic Interface

249
Controlled via Quanser/Simulink (concluded)



7-Cable Robot with Amplifiers


Quanser/Simulink Split Diagram


Here the Simulink closed-loop feedback diagram for the 7-cable robot appears to be open (split)
and incomplete; the plant is missing. However, the real-world machine under control serves as the plant
and no model of this plant is required since the real-world behaves as it will, much better than any model
we can construct. So the gap (split) in this diagram is where the real-world plant is (motors outputs to
and sensors readings (stringpots in this example) from the real-world).

The seventh motor is controlled in a different way for tensioning the cables and entire end-
effector.
250
7.2 Programmable Logic Controller (PLC) Architecture

PLC Controller Diagrams

+
-
Desired Position
P
Error
Actual Position IR Sensor
Calibration
Function
PLC Analog
Output Module
1-10 VDC 20-80 cm PLC Analog
Input Module
PWM
Servo Amp.
DC Motor
Axis 1
Software Routine Controller Chassis
Robot


Closed-Loop Position Control of Axis 1


DC Power Supply
Fuse
Fuse
+
DC Power Supply
Unregulated
-
40VDC
PLC
MCR1
115 VAC
E-Stop
Fuse
GND
L1 L2
MCR1
Off On
MCR2
MCR2
+
5 VDC
Regulated
COM
Axis 1-5
PWM
Servo Amp.
24 VDC
+
Outputs To
Encoders
Digital
Sensors
Switches and
Indicators
Outputs To
Suppresser
MCR1
Suppresser
MCR2


Schematic of Controller Layout and Power Distribution

251
(+/- 10 VDC)
Encoder Feedback
Encoder Feedback
Servo
Amp.
PWM
PWM
Amp.
Servo
Amp.
Servo
PWM
PC Programming Terminal
5
(+/- 10 VDC)
(+/- 10 VDC)
Interface
Serial Port
Supply
Power
PLC
(Slot) Module Type
(1) Servo Card Axis 2 & 3
(2) Servo Card Axis 4 & 5
(0) Processor
(3) Analog Output
(4) Analog Input
(5) Digital Output
(6) Digital Input
PLC
0 1 2 3 4
Ultrasonic
DC Motor
DC Motor
& Encoder
& Encoder
Axis 5
Axis 2
Sensors
DC Motor
Sensor
(1-10 V)
(0-10 V)
Axis 1
IR
Indicators
LED
Switches
Control
Limit &
Space
Expansion
6 For
Power Supply
5 VDC 24 VDC
-
+
+
- +
-


PLC Control System Hardware: Ladder Logic

252
Controlled via PLC



Stewart-Glapat Pallet Handling Device (PHD)




PLC Cabinet PLC Interface

You might also like