### Class 4a – Systems and Solutions - UJ

```Systems and Solutions
Class 4
1st Order Systems
1st Order Systems

dx
dt
 x  f t 
x 0   x o
  time constant (s)
x  Instrument response (output)
f t   Quantity to be measured (input)
1st Order Systems

dx
dt
 x  f t 
x 0   x o
Step Input
f ( t )  K s u s t 
Ramp Input
f ( t )  K r tu s t 
Harmonic Input
f ( t )  K h cos  t 
1st Order Systems with Step Input

dx
dt
 x  K s u t 
x 0   x o
 0, t  0 
u t   

1, t  0 
2
u(t)
1
0
-1
0
Time, t
1
2
1st Order Systems with Step Input
Solution by Integration
dx

 x  Ks
dt
x
K
xo
x 0   x o
 dx
s


 Ks  x
dt
 dx
Ks  x
x
K
xo
 dt
 dx
s
 x
 dt

 x
0
u  K s  x , du   dx
u
dx
t
t

 dt
0

uo
du
t

u
 dt ,
0
 u
  ln 
 uo

 u
  t , ln 

u

 o
Ks  x
x  Ks
K s  xo

xo  K s

  t 


e
x t   K s   x o  K s e
t 
t 
Error Ratio
1st Order Systems with Step Input
Error Ratio and Excitation Ratio
1
Error:
Output deviation from input
0.8
Excitation:
Output deviation from its initial value
0.4
Excitation Ratio
0.6
Error Ratio
0.2
time, t
0
Error Ratio  rerr 
rerr 
rerr 
Current Error
Starting Error
Current deviation from input value
0
K s  xo

x  Ks
xo  K s
 e
t 
2
Excitation Ratio  rex 
rex 
Starting deviation from input value
Ks  x
1
rex 
3
4
5
Current Excitation
Desired Excitation
Output deviation from its initial value
Input deviation from initial output
x  xo
K s  xo
1
K s  xo
K s  xo
 K  xo
x  xo
rex  1   s

K s  xo
 K s  xo
 Ks  x
rex  1  
 K s  xo

x  xo
K s  xo





t 
  1  rerr  1  e


1st Order Systems with Step Input
Solution by Superposition
Assume a solution of the form

dx
dt
x t   x h t   x p t 
 x  Ks
where
x 0   x o
 x h  x h  0
and
 x p  x p  K s
Solution of the particular equation
 x p  x p  K s
For the homogenoeu s ODE
is found by observatio n
 x h  x h  0
x p t   K s
Assume
The complete solution is thereofore
x h t   Ce
rt
 x h t   rCe
rt
x t   x p t   x h t   K s  Ce
Substituti ng into homogeneou s ODE
 x h  x h  0 ,  rCe
rt
 Ce
rt
 0 ,  r  1 Ce
 r  1, r   1   x h t   Ce
t 
t 
To satisfy the initial condition,
rt
0
x 0   K s  C  x o , C  x o  K s
x t   K s   x o  K s e
t 
1st Order Systems with Step Input
Solution by Laplace Transform

dx
dt
X ( s )  xo
 x  Ks
  sX ( s )  x o   X ( s ) 
 sX ( s )  X ( s ) 
Ks
s
X ( s )  s  1  
X (s) 
s s  1 

 A

B

X ( s )  x o  


s
s

1



x 0   x o
X (s) 
s  K s xo
s
 xo
K s  sxo
s
K s  sxo
s  s  1 
xo s  K s xo 
s s  1  
Ks
 s  K s xo
A   s  0 
 s s  1  


 K s xo
 s 0
 s  K s xo
B   s  1  
 s s  1  
B 
 1   K s xo
1 


 s  1 
 1  K s xo
K x
1  K s xo 

X ( s )  x o  s o 


s
s

1



X (s) 
Ks
xo  K s
s  1  
t 
  x o  K s e
s
x t   K s

1st Order Systems with Unit Step Input and Unit Time Constant
MATLAB Simulation by Transfer Function

dx
dt
>> num=1;
>> den=[1 1];
>> sys = tf(num,den);
>> step(sys)
>> grid
 x  f t 
x 0   0
 sX ( s )  X ( s )  F  s 
Step Response
1
X ( s )  s  1   F  s 
F s 

1
s  1
0.8
0.7
Transfer
Function
0.6
Amplitude
X (s)
0.9
0.5
0.4
0.3
0.2
0.1
0
0
1
2
3
Time (sec)
4
5
6
1st Order Systems with Unit Step Input and Unit Time Constant

dx
dt
dx
dt

 x  u t 
1

u t   x 
1st Order Systems with Ramp Input

dx
dt
 x  x o  K r tu t 
x 0   x o
 0, t  0 
u t   

1, t  0 
tu t 
1st Order Systems with Ramp Input
Solution by Superposition
Solution of the particular equation

dx
dt
 x  x o  K rt
x 0   x o
Assume a solution of the form
 x p  x p  x o  K r t
x t   x h t   x p t 
Assume a solution of the form
where
x p t   At  B , x p t   A
 x h  x h  0
Substitute into the ODE
and
 A  At  B  x o  K r t
 x p  x p  x o  K r t
A  Kr
A  B  xo ,
For the homogenoeu s ODE
B  xo  A  xo  K r
 x h  x h  0
x p t   K r t     x o
Assume
x h t   Ce
rt
 x h t   rCe
The complete solution is thereofore
rt
x t   x p t   x h t   x o  K r t     Ce
Substituti ng into homogeneou s ODE
 x h  x h  0 ,  rCe
rt
 Ce
rt
 0 ,  r  1 Ce
 r  1, r   1   x h t   Ce
t 
To satisfy the initial condition,
rt
0
x 0   x o   K r  C  x o , C   K r
x t   x o  K r t      K r e
x t   x o  K r t  K r 1  e
t 
t 

t 
1st Order Systems with Ramp Input
Steady State Error and Relative Error

dx
dt
 x  x o  K r tu t 
x t   x o  K r t  K r 1  e
t 

x 0   x o
1
error  Input - Output
0.9
error   x o  K r t   x t 
error  K r 1  e
t 
Err r
0.8

0.7
0.6
e ss  lim  error
0.5
t 

e ss  lim  K r 1  e
t 
t 

0.4
0.3
e ss  K r
Relative error 
Err r 
K r 1  e
K r
Error
t 
 1 e
0.2
0.1
0
t 
 t
0
0.5
1
1.5
2
2.5
3
3.5
4
1st Order Systems with Ramp Input
Relative Input and Relative Excitation

dx
dt
 x  x o  K r tu t 
4
x 0   x o
3.5
x t   x o  K r t  K r 1  e
t 
3

Relative Input
2.5
1
2
Relative Input 
Input - Initial Value
Relative Input 
K rt
S.S.E
K r
K r t  K r 1  e
K r
t 
Relative Excitation
1
 t 
0.5
Relative Excitation  ex r 
ex r 
1.5
Current Excitation
  t   1  e 
t 
 t
0
0
0.5
1
1.5
2
2.5
3
3.5
4
1st Order Systems with Ramp Input
Solution by Laplace Transform

dx
dt
 x  x o  K r t , x 0   x o
xo
  sX ( s )  x o   X ( s ) 
xo
 sX ( s )  X ( s ) 

X ( s )  s  1  
X (s) 
s
Kr
s
s

2
Kr
s
2
 xo
xo s 2  xo s  K r
s
2
2
 s
s 
2
X ( s )  xo
s
2
 1
1

s
Kr
xo
X (s) 
s  1  
 A
B
X ( s )   x o  2 

s
 s
K 
  2 1
  s  s  r 
d  2
xo  K r

xo  
B 
s

2
ds    s  s  1    
xo
 

  s 0
 
Kr 
 2 1
s  s



x
o 
C   s  1  
 K r xo
2
 s s  1   



 s  1 
xo s 2  xo s  K r
s
Kr 
 2 1
s  s


xo 
2
A s
 K r xo
 s 2 s  1   



 s 0
Kr
s


s  1   
C
2

x o  K r
s

K r
s  1  
x t   K r t  x o  K r  K r e
x t   x o  K r t  K r 1  e
t 
t 

1st Order Systems with Unit Ramp Input and Unit Time Constant
MATLAB Simulation by Transfer Function

 MATLAB does not have a ‘ramp’
command to plot the ramp response
of the system. However, note that
the response, Rst(s) of a system with
transfer function G(s) to unit step
input is Rst(s) = G(s)/s, and its
response to a unit ramp input is
Rrmp(s) = G(s)/s2 = (G(s)/s)/s . Thus,
the response of G(s) to unit ramp is
equal to the response of H(s) =
G(s)/s to unit step.
 We may use MATLAB’s ‘step’
command to obtain the ramp
response of a system G(s) simply by
obtaining the step response of H(s) =
G(s)/s to unit step.
dx
dt
 x  f t 
>> num = [0 0 1];
>> den = [1 1 0];
>> t=0:0.1:5;
>> sys = step(num,den,t);
>> plot(t,sys,'o',t,t,'-')
>> grid
x 0   0
 sX ( s )  X ( s )  F  s 
X ( s )  s  1   F  s 
G (s) 
X (s)
H (s) 
G (s)
F s 
s


1
s  1
1
s ( s  1)

1
s  s
2
5
4.5
4
3.5
3
2.5
2
1.5
1
0.5
0
0
1
2
3
4
5
1st Order Systems with Unit Step Input and Unit Time Constant

dx
dt
dx
dt

 x  tu t 
1

tu t   x 
1st Order Systems with Harmonic Input
1

dx
dt
 x  K h cos  t 
x 0   0
0
-1
0
2
4
6
8
10
12
1st Order Systems with Harmonic Input
Solution by Superposition
sin    2   sin  cos  2   cos  sin  2   cos  
cos    2   cos  cos  2   sin  sin  2   sin  
Solution of the particular equation

dx
dt
 x p  x p  K h cos(  t )
 x  K h cos  t 
Assume a solution of the form
x 0   0
x p t   A cos(  t   )
x p t    A  sin(  t   )
Assume a solution of the form
x t   x h t   x p t 
x p t    A  cos(  t     2 )
where  x h  x h  0 and  x p  x p  x o  K r t
Substitute into the ODE
For the homogenoeu s ODE
 A  cos(  t     2 )  A cos(  t   )  K h cos(  t )
 x h  x h  0
From the vector plot
A   A    K h
x h t   Ce
2
2
Assume
rt
 x h t   rCe
  tan
Substituti ng into homogeneou s ODE
 x h  x h  0 ,  rCe
rt
 Ce
rt
 0 ,  r  1 Ce
 r  1, r   1   x h t   Ce
1  
A  Kh
rt
t 
rt
0
1
 
2
τAω

2
A
ϕ
Kh
ωt
1st Order Systems with Harmonic Input
Amplitude Ratio and Phase
f(t)
1

dx
dt
 x  K h cos  t 
x(t)
ra
0
x 0   0
ϕ
x t   A cos(  t   )
1   
A  Kh
  tan
1
2
-1
 
0
2
4
6
8
10
1.5
Amplitude Ratio  ra 
ra  A K h  1
Phase    tan
1   
1
 
Output Amplitude
Input Amplitude
1
ϕ (τω)
ra (τω)
2
0.5
0
-2
10
10
-1
10
0
τω
10
1
10
2
12
1st Order Systems with Harmonic Input
Solution by Complex Exponential
Euler’s Identity
Multiplication &
Division Rules
y
e
i
 cos   i sin 
z = Aeiωt
z  Ae
z1  A1 e
i t
A
z  A cos  t  iA sin  t
i 1
i 2
z 2  A2 e
ωt
z  x  iy
z1 z 2  A1 e
x
z1
z2
A1 e

A2 e
i 1
A2 e
i 1
i 2
i 2
A1

 A1 A2 e
e
i  1   2
A2
y
Complex Conjugate
z = Aeiωt
z  Ae
i t
z *  Ae
x  Re  z   A cos  t 
Power Rules
A
 i t
ωt
1
2
z 
z *
x
-ωt
z  Ae
z   Ae
n
z
z* =
i
Ae-iωt
1 n
i
  Ae

i
n
 A e
n

1 n
in 
1 n
 A e
i n

i  1   2

Second Order Systems
 In the system shown, the input
displacement, xi, will cause a
deflection in the spring, and
some time will be needed for
the output displacement xo to
reach the input displacement.
xo
xi
c
m
k
Second Order Systems
F
 m xo
k  x i  x o   c  x i  x o   m xo
xi
xo
c
m xo  c x o  kx o  c x i  kx i
m
k
xo 
c
k
x o  x o  c x i  kx i
m
k
 If m/k << 1 s2 and c/k << 1 s, the system may be approximated as a zero
order system with unity gain.
 If, on the other hand, m/k << 1 s2 , but c/k is not, the system may be
approximated by a first order system. Systems with a storage and
dissipative capability but negligible inertial may be modeled using a
first-order differential equation.
Example – Automobile Accelerometer
 Consider the accelerometer used in
seismic and vibration engineering to
determine the motion of large bodies to
which the accelerometer is attached.
 The acceleration of the large body places
the piezoelectric crystal into compression
or tension, causing a surface charge to
develop on the crystal. The charge is
proportional to the motion. As the large
body moves, the mass of the
accelerometer will move with an inertial
response. The stiffness of the spring, k,
provides a restoring force to move the
accelerometer mass back to equilibrium
while internal frictional damping, c,
opposes any displacement away from
equilibrium.
Piezoelectric
crystal
xi
xo
c
m
k
Zero-Order systems
 Can we model the system below as a zero-order system? If the mass,
stiffness, and damping coefficient satisfy certain conditions, we may.
xo
xi
c
m
k
F
 m xo
k  x i  x o   c  x i  x o   m xo
k  x i  x o   c  x i  x o   m  xi  xo   m xi
k   c   m   m xi
First Order Systems
 Measurement systems that contain
storage elements do not respond
instantaneously to changes in input. The
bulb thermometer is a good example.
When the ambient temperature changes,
the liquid inside the bulb will need to
store a certain amount of energy in order
for it to reach the temperature of the
environment. The temperature of the
bulb sensor changes with time until this
equilibrium is reached, which accounts
physically for its lag in response.
 In general, systems with a storage or
dissipative capability but negligible inertial
forces may be modeled using a first-order
differential equation.
1st Order Systems with Step Input
error ratio =
excitation ratio =
current error current deviation from final value
=
starting error starting deviation from final value
current excitation
current deviation from initial value
=
desired (input) excitation
input deviation from initial value

+  = ()

0 = 0
=  + 0 −   −/
Error Ratio
−
=  −/
0 −
Excitation
Ratio
− 0
= 1 −  −/
− 0
Excitation ratio may also be called response ratio
= current response / desired response
 Note that the excitation ratio also represents
the system response in case of x0=0 and K=1
Example 1
 A bulb thermometer with a time constant τ
=100 s. is subjected to a step change in the
input temperature. Find the time needed
for the response ratio to reach 90%
Example 1 Solution
 A bulb thermometer with a time constant τ =100 s. is subjected to a
step change in the input temperature. Find the time needed for the
response ratio to reach 90%
− 0
= 1 −  −/ = 0.9
− 0
−
=  −/ = 0.1
0 −
= ln 10 = 2.3
= 2.3 ×  = 230 .
≈ 4 minutes
1st Order Systems with Ramp Input

+  = 0 +  ()

0 = 0
excitation ratio =
= 0 +   −  (1 −  −/ )
Error =   −   = − (1 −  −/ )
. .  = lim () − ()
→∞
. .  =
=
− 0

(1 −  −/ )
= 1 −

Note that using L’Hospital rule
lim
→0
= lim
→0
1−
(1 −  −/ )

1 − lim
→0
1 −  −/

−/
= 1 − lim
= 1−1= 0
→0 1
excitation ratio =
current excitation
desired (input) excitation
current deviation from initial value
input deviation from initial value
1st Order Systems with Harmonic Input

+  =  cos⁡
(ωt)

=  −/ + cos⁡
(ωt − φ)
C depends on the initial conditions and the
exponential term will vanish with time. We
are interested in the particular steady
solution cos⁡
(ωt − φ). Solving for  and φ,
we find
=

1 +
φ = tan−1
2
1st Order Systems with Harmonic Input
Define the amplitude ratio  =   and
the time ratio  =   where  = 2  is
the period of the excitation function,
=

=

1
1 +
2
=
1
1 + 4 2  2
φ = tan−1  = tan−1 2
1st Order Systems with Harmonic Input
 The amplitude ratio, Ar(ω), and the
corresponding phase shift, ϕ, are
plotted vs. ωτ. The effects of τ and
ω on frequency response are
shown.
 For those values of ωτ for which the
system responds with Ar near unity,
the measurement system transfers
all or nearly all of the input signal
amplitude to the output and with
very little time delay; that is, X will
be nearly equal to F in magnitude
and ϕ will be near zero degrees.
1st Order Systems with Harmonic Input
 At large values of ωτ the measurement system filters out any frequency
information of the input signal by responding with very small amplitudes,
which is seen by the small Ar(ω) , and by large time delays, as evidenced by
increasingly nonzero ϕ.
1st Order Systems with Harmonic Input
 Any equal product of ω
and τ produces the
same results. If we
wanted to measure
signals with highfrequency content, then
we would need a system
having a small τ.
 On the other hand,
systems of large τ may
signals of low-frequency
content. Often the
available technology
against cost.
dB = 20 log Ar(ω)
1st Order Systems with Harmonic Input
 The dynamic error,δ(ω), of a system is defined as
δ(ω) = (X(ω) – F)/F
δ(ω) = Ar(ω) –1
It is a measure of the inability of a system to adequately reconstruct the
amplitude of the input signal for a particular input frequency. We normally
want measurement systems to have an amplitude ratio at or near unity over
the anticipated frequency band of the input signal to minimize δ(ω) .
 As perfect reproduction of the input signal is not possible, some dynamic error
is inevitable. We need some way to quantify this. For a first-order system, we
define a frequency bandwidth as the frequency band over which Ar(ω) >
0.707; in terms of the decibel defined as
dB = 20 log Ar(ω)
This is the band of frequencies within which Ar(ω) remains above 3 dB
Example 2
A temperature sensor is to be selected to measure temperature within a
reaction vessel. It is suspected that the temperature will behave as a simple
periodic waveform with a frequency somewhere between 1 and 5 Hz. Sensors
of several sizes are available, each with a known time constant. Based on time
constant, select a suitable sensor, assuming that a dynamic error of 2% is
acceptable.
Example 2. Solution
 A temperature sensor is to be
selected to measure temperature
within a reaction vessel. It is
suspected that the temperature will
behave as a simple periodic
waveform with a frequency
somewhere between 1 and 5 Hz.
Sensors of several sizes are
available, each with a known time
constant. Based on time constant,
select a suitable sensor, assuming
that an absolute value for the
dynamic error of 2% is acceptable.
 Accordingly, a sensor having a time
constant of 6.4 ms or less will work.
ω
≤ 0.02
−0.02 ≤  ω ≤ 0.02
−0.02 ≤  − 1 ≤ 0.02
0.98 ≤  ≤ 1.02
0.98 ≤
1
1 +
2
≤ 1.0
0 ≤  ≤ 0.2
The smallest value of  will occur at
the largest frequency
= 2 = 2(5)
0 ≤ 2(5) ≤ 0.2
≤ 6.4 × 10−3 s.
Example 2. Solution
 A temperature sensor is to be
selected to measure temperature
within a reaction vessel. It is
suspected that the temperature will
behave as a simple periodic
waveform with a frequency
somewhere between 1 and 5 Hz.
Sensors of several sizes are
available, each with a known time
constant. Based on time constant,
select a suitable sensor, assuming
that an absolute value for the
dynamic error of 2% is acceptable.
 Accordingly, a sensor having a time
constant of 6.4 ms or less will work.
ω
≤ 0.02
−0.02 ≤  ω ≤ 0.02
−0.02 ≤  − 1 ≤ 0.02
0.98 ≤  ≤ 1.02
0.98 ≤
1
1 +
2
≤ 1.0
0 ≤  ≤ 0.2
The smallest value of  will occur at
the largest frequency
= 2 = 2(5)
0 ≤ 2(5) ≤ 0.2
≤ 6.4 × 10−3 s.
2nd Order Systems
 Example:
 Spring – mass damper
 RLC Circuits
 Accelerometers
 Mathematical Model:
2

+
2
+  2  =

2

Damping ratio (dimensionless)

Natural frequency (1/s)
: Input (quantity to be measured)
:
Output (instrument response)
2nd Order Systems with step input
= ()
=
0 <0
1 ≥0
ds
2

2
+
2
+

=

2

Damping ratio (dimensionless)

Natural frequency (1/s)
: Input (quantity to be measured)
:
Output (instrument response)
:
Arbitrary constant
2nd Order Systems with step input
2nd Order Systems with step input
2nd Order Systems with periodic input
2nd Order Systems with step input
```