0% found this document useful (0 votes)
24 views

Linear Control Systems Lab

Uploaded by

aliabeed323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Linear Control Systems Lab

Uploaded by

aliabeed323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 87

Systems Laboratory

Prepared by: Khaled Mustafa Mahmoud

Session: Fall 2016


𝐂𝐨𝐮𝐫𝐬𝐞 𝐒𝐲𝐥𝐥𝐚𝐛𝐮𝐬 𝐒𝐜𝐡𝐞𝐝𝐮𝐥𝐞
𝐖𝐞𝐞𝐤 𝐈𝐭𝐞𝐦

𝟏
State Variable Models.
𝟐

𝟑
Routh − Hurwitz Criterion.
𝟒

𝟓
Root Locus Technique.
𝟔

𝟕
Bode Plots.
𝟖

𝐌𝐢𝐝 – 𝐓𝐞𝐫𝐦 𝐄𝐱𝐚𝐦

𝟗
Nyquist Criterion.
𝟏𝟎

𝟏𝟏 Nichols − Chart.
𝟏𝟐
𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞𝐬

1. N. NISE, Control Systems Engineering, WIELY, 4th ed. 2004.

2. R. Dorf and R. Bishop, Modern Control Systems, Prentice Hall, 11th ed. 2008.

3. Katsuhiko Ogata, Modern Control Engineering, Prentice Hall, 3rd ed. 1997.
1

MATLAB Applications No. (1)


State Variable Models

 Objectives:
The objectives of this application are to:
1. Obtain the state space model from the differential equations or transfer
function.
2. Convert between transfer function and state space models.
3. Determine the state transition matrix Φ(𝑠).

 State Variable Models:

The modern control tendency in engineering systems is toward greater


complexity, due mainly to the requirements of complex tasks and good
accuracy. Complex systems may have multiple inputs and multiple
outputs and may be time varying. Because of the necessity of meeting
increasingly stringent requirements on the performance of control
systems, the increase in system complexity, and easy access to large scale
computers, modern control theory, which is a new approach to the
analysis and design of complex control systems (called is the state-space
approach). This new approach is based on the concept of state.

 Advantages State Space Techniques:

This technique has the following advantages:


1. This approach can be applied to linear or nonlinear, time varying or
time invariant systems.
2. It is easier to apply where the Laplace transform cannot be applied.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


2

3. This method is suitable for digital computer computation because this


is time domain approach.
4. This approach can be applied to multiple-input, multiple-output
systems.

 State Space Representation:


In state-space analysis we are concerned with three types of variables that
are involved in the modeling of dynamic systems: input variables, output
variables and state variables. A system is represented in state space by the
following equations:
𝑥̇ (𝑡) = A𝑥(𝑡) + B𝑢(𝑡) (State Equation)

𝑦(𝑡) = C𝑥(𝑡) + D𝑢(𝑡) (Output Equation)

Where:
𝑥 = state vector, 𝑥̇ = derivative of state vector with respect to time.
𝑦 = output vector, 𝑢 = input or control vector.
A = system matrix, B = input matrix, C =output matrix, D= feedforward
matrix.
A block diagram representation of state and output Equations is shown
in Figure 1.1.

Figure 1.1: Block diagram of the control system represented in state space.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


3

The state-space representation for a given system is not unique because


there is more than one alternative set of state variables, except that the
number of state variables is the same for any of the different state-space
representations of the same system. There are several key canonical
forms of the state variable representation, such as the Phase Variable
Canonical Form, that we will investigate in this application. In general, we
can represent state space model (let consider the third order transfer
function when the nominator is a polynomial in s) as:
𝑌(𝑠) 𝑏2 𝑠 2 + 𝑏1 𝑠 + 𝑏0
𝐺(𝑠) = =
𝑈(𝑠) 𝑎3 𝑠 3 + 𝑎2 𝑠 2 + 𝑎1 𝑠 + 𝑎0
𝑌(𝑠) 𝑏2 𝑠 −1 + 𝑏1 𝑠 −2 + 𝑏0 𝑠 −3
𝐺(𝑠) = =
𝑈(𝑠) 1 + 𝑎2 𝑠 −1 + 𝑎1 𝑠 −2 + 𝑎0 𝑠 −3
In phase variable canonical form, we can represent this transfer function
as:
𝑥̇ 1 0 1 0 𝑥1 0
[ 𝑥̇ 2 ] = [ 0 0 𝑥
1 ] [ 2 ] + [0] 𝑢(𝑡)
𝑥̇ 3 −𝑎0 −𝑎1 −𝑎2 𝑥3 1
𝑥1
𝑦(𝑡) = [𝑏0 𝑏1 𝑏2 ] [𝑥2 ]
𝑥3
To obtain the transfer function from the state-space equations, we can be
used the following expression:
𝐺(𝑠) = C(SI − A)−1 B + D
Where: (SI − A)−1 = Φ(𝑠) is called the state transition matrix. The state
transition matrix is the exponential function that describes the unforced
response of the system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


4

Example 1.1: A single loop control system is shown in Figure 1.2. The
closed loop transfer function of the system is:
𝑌(𝑠) 2𝑠 2 + 8𝑠 + 6
𝑇(𝑠) = =
𝑅(𝑠) 𝑠 3 + 8𝑠 2 + 16𝑠 + 6

Figure 1.2: Single loop control system.

Use MATLAB to obtain state space representation of the system in the


phase variable canonical form.
Solution:
>> % To convert the transfer function T(s)=(2s^2+8s+6)/(s^3+8s^2+16s+6)..%
>> % to state space model %
>> num=[2 8 6];
>> den=[1 8 16 6];
>> T=tf(num,den)
Transfer function:
2 s^2 + 8 s + 6
-----------------------------
s^3 + 8 s^2 + 16 s + 6
>> [a,b,c,d]=tf2ss(num,den);
>> % To obtain the state space model in the phase variable canonical form %
>> A=flipud(fliplr(a))
A=
0 1 0
0 0 1
-6 -16 -8
>> B=flipud(b)
B=
0
0
1
>> C=fliplr(c)
C=
6 8 2

Khaled Mustafa Mahmoud Session: Fall 2015/2016


5

Example 1.2: A system is described by the differential equation:


𝑦⃛ + 6𝑦̈ + 11𝑦̇ + 6𝑦 = 20 𝑢(𝑡)

Where 𝑦 is the output and 𝑢 is the input to the system (𝑢(𝑡) = 1). Obtain
state space representation of the system.
Solution:
>> % Firstly, convert the differential equation to transfer function%
>> Y=laplace(dsolve('D3y+6*D2y+11*Dy+6*y=20','y(0)=0,Dy(0)=0,D2y(0)=0'));
>> pretty(simplify(Y))
20
------------------------------ % Y(s) = T(s)*U(s), U(s) = 1/s %
s (s + 1) (s + 2) (s + 3)
>> % The transfer function T(s)=20/(s+1)(s+2)(s+3) %
>> num=20;
>> den=conv([1 1],conv([1 2],[1 3]));
>> [a,b,c,d]=tf2ss(num,den);
>> % To obtain the state space model in the phase variable canonical form %
>> A=flipud(fliplr(a))
A=
0 1 0
0 0 1
-6 -11 -6
>> B=flipud(b)
B=
0
0
1
>> C=fliplr(c)
C=
20 0 0

Khaled Mustafa Mahmoud Session: Fall 2015/2016


6

Example 1.3: The two tank system shown in Figure 1.3(a) is controlled by
a motor adjusting the input valve and ultimately varying the output flow
rate. The system has the block diagram shown in Figure 1.3(b). Use
MATLAB to:
1. Obtain the matrix differential equation for the phase variable form.
2. Plot the output response of the system when the input signal is unit step.

Figure 1.3: A two tank system with the motor current controlling the output flow rate.
(a) Physical diagram. (b) Block diagram.
Solution:
>> % Firstly, determine the transfer function: G(s)= Q o(s)/I(s)%
>> s=tf('s');
>> G1=10/(s+5);
>> G2=3/(s+2);
>> G3=1/(s+3);
>> G=series(G1,series(G2,G3))
Transfer function:
30
--------------------------------
s^3 + 10 s^2 + 31 s + 30

Khaled Mustafa Mahmoud Session: Fall 2015/2016


7

>> % To convert the transfer function G(s)=1/(s^3+10s^2+31s+30)..%


>> % to state space model %
>> num=30;
>> den=[1 10 31 30];
>> [a,b,c,d]=tf2ss(num,den);

>> % To obtain the state space model in the phase variable canonical form %
>> A=flipud(fliplr(a))
A=
0 1 0
0 0 1
-30 -31 -10
>> B=flipud(b)
B=
0
0
1
>> C=fliplr(c)
C=
30 0 0
>> % To plot the output response of the system for the unit step input %
>> t=0:0.01:10;
>> r=heaviside(t);
>> lsim(a,b,c,d,r,t)
>> title('Step Response of the Two Tank System')
>> xlabel('Time')
>> ylabel('Output Flow Rate')
>> gtext('Input')
>> gtext('Output')

Khaled Mustafa Mahmoud Session: Fall 2015/2016


8

Step Response of the Tw o Tank System

Input
1

Output

0.8
Output Flow Rate

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)

Figure 1.4: Output response of the two tank system for Example 1.3.

Example 1.4: A single input single output system has the matrix equation:

0 1 0
𝑥̇ = [ ]𝑥 + [ ]𝑢
−3 −4 1

and

𝑦 = [10 0]𝑥

Using MATLAB:
1. Determine the state transition matrix Φ(𝑠).
2. Determine the transfer function 𝐺(𝑠) = 𝑌(𝑠)/𝑈(𝑠).

Khaled Mustafa Mahmoud Session: Fall 2015/2016


9

Solution:

>> % 1. To determine the state transition matrix 𝚽(𝐬) %


>> syms s
>> A=[0 1;-3 -4];
>> B=[0;1];
>> C=[10 0];
>> D=[0];
>> I=eye(2);
>> Phi=inv(s*I-A)
>> pretty(Phi)
+- -+
| s+4 1 |
| -------------------, --------------- |
| s2 +4s+3 s 2+ 4 s + 3 |
| -3 s |
| -------------------, ------------------ |
| s2 + 4 s + 3 s2 + 4 s + 3 |
+- -+

>> % 2. To determine the transfer function 𝑮(𝒔) = 𝒀(𝒔)/𝑼(𝒔) %

>> [num,den]=ss2tf(A,B,C,D) >> G=C*Phi*B


num = >> pretty(G)
0 0 10
den =
1 4 3
>> G=tf(num,den)

Transfer function:
10
------------------
s^2 + 4 s + 3

Khaled Mustafa Mahmoud Session: Fall 2015/2016


10

Example 1.5: Transfer function of a system is:


𝑌(𝑠) 3𝑠 2 + 10𝑠 + 15
=
𝑅(𝑠) 𝑠 3 + 8𝑠 2 + 12𝑠 + 9
That can be represented in the state space model for the phase variable
form, where:
𝑥̇ 1 0 1 0 𝑥1 0
[ 𝑥̇ 2 ] = [ 0 0 1 ] [𝑥2 ] + [0] 𝑟(𝑡)
𝑥̇ 3 −9 −12 −8 𝑥3 1
𝑥1
𝑦(𝑡) = [15 10 3] [𝑥2 ]
𝑥3
Using MATLAB Simulink:
1. Simulate the state space model of the system.
2. Obtain the output response for the unit step input.
Solution:
The simulation of the system using MATLAB Simulink as shown in Figure 1.5:

Figure 1.5: Simulation the system of Example 1.5 using MATLAB Simulink.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


11

The unit step response of the system as shown in Figure 1.6:


Unit Step Response of the System
1.8

1.6 Output

1.4

1.2

1
Output

Input

0.8

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
Time(sec)
Figure 1.6: Unit step response of the system for Example 1.5.
--------------------------------------------------------------------------------------------
Homework 1.1: Consider the spring - mass - damper system as shown in
Figure 1.7. The external force 𝑟(𝑡) is the input to the system (unit step),
and the displacement 𝑦(𝑡) of the mass is the output where 𝑀 = 1.5 kg,
𝑘 = 100 N/m, and 𝑏 = 20 N. s/m.

Figure 1.7: A spring – mass – damper system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


12

Do the following:
1. Obtain the differential equation of the system. Assume the initial
conditions equals to zero.
2. Use MATLAB to obtain state space representation of the system in the
phase variable canonical form.
--------------------------------------------------------------------------------------------
Homework 1.2: A system has a block diagram as shown in Figure 1.8. Do
the following using MATLAB:
1. Determine the overall transfer function 𝑌(𝑠)/𝑅(𝑠).
2. Determine the state variable differential equation in a matrix form.
3. Obtain the state transition matrix Φ(𝑠) and Φ(𝑡).

Figure 1.8: Feedback control system.


--------------------------------------------------------------------------------------------
Homework 1.3: Consider the two systems:
0 1 0 0
𝑥̇ 1 = [ 0 0 1 ] 𝑥1 + [0] 𝑢
−4 −5 −8 4

𝑦 = [1 0 0]𝑥1 (1)
and

0.5000 0.5000 0.7071 0


𝑥̇ 2 = [ −0.5000 −0.5000 0.7071 ] 𝑥2 + [0] 𝑢
−6.3640 −0.7071 −8.000 4
𝑦 = [0.7071 −0.7071 0]𝑥2 (2)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


13

Perform the following:


1. Using the tf function, determine the transfer function 𝑌(𝑠)/𝑅(𝑠) for
system (1).
2. Repeat part (1) for system (2).
3. Compare the results in parts (1) and (2) and comment.
--------------------------------------------------------------------------------------------
Homework 1.4: A single input single output system has the matrix equation:
𝑥̇ 1 0 1 0 𝑥1 0
[𝑥̇ 2 ] = [ 0 0 1 ] [𝑥2 ] + [0] 𝑟(𝑡)
𝑥̇ 3 −3 −2 −5 𝑥3 4
𝑥1
𝑦 = [1 0 0] [𝑥2 ]
𝑥3
1. Simulate the state space model of the system using MATLAB Simulink,
and obtain the output response for the sine wave input.
2. Using the tf function, determine the transfer function 𝑌(𝑠)/𝑅(𝑠).
3. Repeat part (1) if the system in the transfer function form.
4. Compare the results in parts (1) and (3) and comment.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


14

Experiment No. (1)


Routh-Hurwitz Criterion

 Objective:
The objective of this experiment is to determine a stability of the linear
control system using Routh-Hurwitz criterion.

 Introduction:

Stability is the most important system specification, if the system is


unstable, transient response and steady state error are moot points.
Physically, an unstable system can cause damage to the system, to
adjacent property, or to human life.
There are many techniques to investigate the stability of control
systems, like as Routh Hurwitz criterion and Root Locus method in the
time domain. Also, we have other methods in the frequency domain,
such as Bode Plot, Nyquist Diagram, and Nichols - Chart.

 Routh-Hurwitz Criterion:

Routh - Hurwitz criterion that yields stability information without the


need to solve for the closed loop system poles. Using this method, we
can tell how many closed loop system poles are in the left half - plane,
in the right half - plane, and on the imaginary axis, but we cannot find
their coordinates. The zeros of control systems affect the system
response to an input. But don’t have direct role in the stability of the
system.
This criterion requires there is no changes in sign in the first column
for a stable system, If all elements are not of the same sign, that means
the system is unstable, and the number of sign change of the elements

Khaled Mustafa Mahmoud Session: Fall 2015/2016


15

in first column equals the number of roots of the characteristic


equation in the right half -plane .
The characteristic equation is: 1 + 𝐺(𝑠)𝐻(𝑠) = 0.

Example 2.1: Consider the unity feedback system of Figure 2.1 with:
200
𝐺(𝑠) =
𝑠(𝑠 3 + 6𝑠 2 + 11𝑠 + 6)

Check whether the system is stable or not using MATLAB.

Figure 2.1: Unity feedback system for Example 2.1.

Solution:

First, find the closed loop transfer function as:

𝑌(𝑠) 𝐺(𝑠) 200


= = 4
𝑅(𝑠) 1 + 𝐺(𝑠)𝐻(𝑠) 𝑠 + 6𝑠 3 + 11𝑠 2 + 6𝑠 + 200

𝑠4 1 11 200

𝑠3 6(1) 6(1) 0

𝑠2 10(1) 200(20)

𝑠1 -19 0

𝑠0 20

There are two changes of sign in the first column of array. So there are
two roots in the right half plane, and hence the system is unstable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


16

>> % To determine the stability of the system for Example 2.1 using MATLAB %
>> a=200;
>> b1=[1 0];
>> b2=[1 6 11 6];
>> b=conv(b1,b2);
>> x=tf(a,b);
>> sys=feedback(x,1);
>> p=pole(sys);
>> subplot(1,2,1)
>> pzmap(sys)
>> subplot(1,2,2)
>> step(sys)

Pole-Zero Map 10 Step Response


x 10
3 2

1
2
0

-1
1
Imaginary Axis

-2
Amplitude

0 -3

-4
-1
-5

-6
-2
System: sys
-7 Final Value: Inf
-3 -8
-6 -4 -2 0 2 0 5 10 15 20
Real Axis Time (sec)

Figure 2.2: Pole - Zero map and step response for Example 2.1.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


17

Example 2.2: Use MATLAB to determine the stability of the closed loop
transfer function:
2
𝑇(𝑠) =
𝑠 4 + 2𝑠 3 + 3𝑠 2 + 6𝑠 + 5
Solution:

The characteristic equation is: 𝑠 4 + 2𝑠 3 + 3𝑠 2 + 6𝑠 + 5 = 0

𝑠4 1 3 5

𝑠3 2 6 0

𝑠2 0(𝜀) 5
6𝜀−10
𝑠1 0
𝜀

𝑠0 5

When the first column term in any row zero is occurs (that indicates
there are symmetrical any even roots about the real axis). Since 𝜀 is
small and positive value, it can be seen there is two sign changes in the
first column. Hence, the system is unstable and has two poles are
symmetric about the real axis in the right half plane.

>> % To determine the stability of a system for Example 2.2 using MATLAB %
>> s=tf('s');

>> T=2/(s^4+2*s^3+3*s^2+6*s+5);

>> subplot(1,2,1)

>> pzmap(T)

>> subplot(1,2,2)

>> step(T)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


18

25
Pole-Zero Map x 10 Step Response
2 2
System: T
Final Value: Inf
1.5
1.5

1
0.5
Imaginary Axis

Amplitude
0 0.5

-0.5
0

-1

-0.5
-1.5

-2 -1
-1.5 -1 -0.5 0 0.5 0 50 100 150 200
Real Axis Time (sec)

Figure 2.3: Pole - Zero map and step response for Example 2.2.

Example 2.3: Consider the system has the forward transfer function:
4
𝐺(𝑠) =
𝑠 5 + 4𝑠 4 + 8𝑠 3 + 8𝑠 2 + 7𝑠
Determine the stability of the system using MATLAB.

Solution:

First, find the closed loop transfer function as:

𝑌(𝑠) 𝐺(𝑠) 4
= = 5
𝑅(𝑠) 1 + 𝐺(𝑠)𝐻(𝑠) 𝑠 + 4𝑠 4 + 8𝑠 3 + 8𝑠 2 + 7𝑠 + 4

𝑠5 1 8 7

𝑠4 4 8 4

𝑠3 6 6

𝑠2 4 4

𝑠1 0 0 → Auxiliary Equation A(s)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


19

The term in the 𝑠1 row are all zeros.


𝐴(𝑠) = 4𝑠 2 + 4

𝑑𝐴(𝑠)
= 8𝑠 + 0
𝑑𝑠
Replace the row of zeros with the derivative constants.

𝑠5 1 8 7

𝑠4 4 8 4

𝑠3 6 6

𝑠2 4 4

𝑠1 8 0

𝑠0 4

When a row of all zeros occurs (that indicates there are roots symmetrical
about the origin), since there is no change of sign in the first column of
array, this means no poles in the right half plane. Also, there is no sign
change from 𝑠 2 row down to the 𝑠 0 row. Thus, the system is marginally
stable and has two poles on the imaginary axis.

>> % To determine the stability of a system for Example 2.3 using MATLAB %
>> a=4;
>> b=[1 4 8 8 7 0];
>> x=tf(a,b);
>> sys=feedback(x,1);
>> subplot(1,2,1)
>> pzmap(sys)
>> subplot(1,2,2)
>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


20

Pole-Zero Map Step Response


1.5 1.8

1.6
1
1.4

0.5 1.2
Imaginary Axis

Amplitude
1
0
0.8

-0.5 0.6

0.4
-1
0.2

-1.5 0
-2 -1 0 1 0 10 20 30
Real Axis Time (sec)

Figure 2.4: Pole - Zero map and step response for Example 2.3.

Example 2.4: Consider the system given in Figure 2.5. Find the range of
values of K for which the system to be stable, unstable, and marginally
stable. Also, find the frequency of oscillation. Verify your results using
MATLAB.

Figure 2.5: Closed loop system for Example 2.4.

Solution:
𝐾 1
𝐺(𝑠) = , 𝐻(𝑠) =
𝑠(𝑠 + 2) 𝑠+1

Khaled Mustafa Mahmoud Session: Fall 2015/2016


21

First, find the closed loop transfer function as:

𝑌(𝑠) 𝐺(𝑠) 𝐾(𝑠 + 1)


= = 3
𝑅(𝑠) 1 + 𝐺(𝑠)𝐻(𝑠) 𝑠 + 3𝑠 2 + 2𝑠 + 𝐾

𝑠3 1 2

𝑠2 3 K
6−𝐾
𝑠1 3

𝑠0 K

The range of K that keeps system stable is: 0 < K <6.

>> % To determine the stability of a system for Example 2.4 when K=3
using MATLAB %
>> s=tf('s');

>> K=3; % In the second case: let K=9, and in the third case: let K=6 %

>> G=1/(s*(s+2));

>> H=1/(s+1);

>> T=feedback(K*G,H);

>> subplot(1,2,1)

>> pzmap(T)

>> subplot(1,2,2)

>> step(T)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


22

Pole-Zero Map Step Response


1.5 2

1.8
1
1.6

1.4
0.5
Imaginary Axis

1.2 System: T

Amplitude
Final Value: 1
0 1

0.8
-0.5
0.6

0.4
-1
0.2

-1.5 0
-3 -2 -1 0 0 10 20 30
Real Axis Time (sec)

Figure 2.6: Pole - Zero map and step response for K=3.

The range of K that makes system unstable is: 0> K >6.


To determine the stability of a system when K=9 using MATLAB:

Pole-Zero Map 5 Step Response


x 10
2 2

1.5 1.5
System: T
Final Value: Inf
1 1
Imaginary Axis

0.5 0.5
Amplitude

0 0

-0.5 -0.5

-1 -1

-1.5 -1.5

-2 -2
-4 -2 0 2 0 50 100
Real Axis Time (sec)

Figure 2.7: Pole - Zero map and step response for K=9.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


23

The value of K that makes system marginally is: K=6.


To determine the stability of a system when K=6 using MATLAB:
Pole-Zero Map Step Response
1.5 3
System: T
Pole : 1.66e-016 + 1.41i 2.5
1Damping: -1.17e-016
Overshoot (%): 100
Frequency (rad/sec): 1.41 2
0.5
Imaginary Axis

1.5

Amplitude
0 1

0.5
-0.5
0
-1
-0.5

-1.5 -1
-3 -2 -1 0 1 0 5 10 15 20
Real Axis Time (sec)
Figure 2.8: Pole - Zero map and step response for K=6.

The oscillation frequency is from 2nd order equation from the second
row we have:

3𝑠 2 + 𝐾|𝐾= 6, and 𝑠=𝑗𝜔 =0

𝜔 = 1.414 rad/sec.

Or it can be obtained from Figure 2.8: 𝜔 = 1.41 rad/sec.

Example 2.5: Consider the system represented in state variable form:


𝑥̇ (𝑡) = 𝐴𝑥(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝑥(𝑡) + 𝐷𝑢(𝑡)
Where:

0 0 1 10
𝐴 = [ −2 −8 1 ], 𝐵 = [ 0 ] , 𝐶 = [1 0 0], and 𝐷 = [0]
−10 −12 −2 0
Find how many poles are in the left half plane, in the right half plane,
and on the imaginary axis using MATLAB.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


24

Solution:
First, from (𝐬𝐈 − 𝐀):
𝑠 0 0 0 0 1 𝑠 0 −1
(sI − A) = [ 0 𝑠 0] − [ −2 −8 1] = [ 2 𝑠 + 8 −1 ]
0 0 𝑠 −10 −12 −2 10 12 𝑠+2
Now, find the det (𝐬𝐈 − 𝐀):

det (sI − A) = 𝑠 3 + 10 𝑠 2 + 38 𝑠 + 56

The characteristic equation is: 𝑠 3 + 10 𝑠 2 + 38 𝑠 + 56 = 0.

𝑠3 1 38

𝑠2 10 56

𝑠1 32.4 0

𝑠0 56

Since there are no sign changes in the first column, the system has all
poles in the left half plane. Therefore, the system is stable.
>> % To determine the stability of the system for Example 2.5 using MATLAB %
>> A=[0 0 1;-2 -8 1;-10 -12 -2];

>> B=[10;0;0];

>> C=[1 0 0];

>> D=0;

>> eig(A);

>> sys=ss(A,B,C,D);

>> subplot(1,2,1)

>> pzmap(sys)

>> subplot(1,2,2)

>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


25

Pole-Zero Map Step Response


2.5 6

2
5
1.5
System: sys
Final Value: 5
1
4
0.5
Imaginary Axis

Amplitude
0 3

-0.5
2
-1

-1.5
1
-2

-2.5 0
-6 -4 -2 0 0 1 2 3 4 5
Real Axis Time (sec)

Figure 2.9: Pole - Zero map and step response for Example 2.5.

Example 2.6: Consider the control system for the two – track vehicle is
shown in Figure 2.10. The design of a turning control for a tracked
vehicle involves the selection of two parameters. Use MATLAB to find
𝑎 and 𝐾 such that the system is stable.

Figure 2.10: Block diagram for two-track vehicle control system.

Solution:
The characteristic equation of the feedback system is:
1 + 𝐺𝑐 (𝑠)𝐺(𝑠) = 0
or
𝐾(𝑠 + 𝑎)
1+
𝑠(𝑠 + 1)(𝑠 + 2)(𝑠 + 5)
Therefore, we have:
𝑠 4 + 8𝑠 3 + 17𝑠 2 + (𝐾 + 10)𝑠 + 𝐾𝑎 = 0

Khaled Mustafa Mahmoud Session: Fall 2015/2016


26

To determine the stable region for 𝐾 and 𝑎, we establish the Routh


array as:

𝑠4 1 17 𝐾𝑎

𝑠3 8 (𝐾 + 10) 0

𝑠2 (126 − 𝐾)/8 𝐾𝑎

(126−𝐾)(𝐾+10)−64𝐾𝑎
𝑠1 0
126−𝐾

𝑠0 𝐾𝑎

For the elements of the first column to be positive, we require that:


𝐾 < 126
𝐾𝑎 > 0
(126 − 𝐾)(𝐾 + 10) − 64𝐾𝑎 > 0
For positive 𝐾, it follows that we can restrict our search to:
0 < 𝐾 < 126 and 𝑎 > 0.
% To plot the a-K region stability for the two track vehicle %
a=[0.1:0.01:2.5];
K=[20:1:120];
x=0*K;y=0*K;
for i=1: length(K)
for j=1: length(a)
q=[1 8 17 K(i)+10 K(i)*a(j)];
p=roots(q)
if max (real(p))>0 , x(i)=K(i);y(i)=a(j); break; end
end
end
plot(x,y)
xlabel('K')
ylabel('a')
gtext('Stable region')

Khaled Mustafa Mahmoud Session: Fall 2015/2016


27

2.5

1.5
a

Stable region

0.5

0
20 30 40 50 60 70 80 90 100 110 120
K
Figure 2.11: Block diagram for two-track vehicle control system.
-----------------------------------------------------------------------------------------
Homework 2.1: Using MATLAB, determine if the following systems are
stable, marginally stable, or unstable. In each case, the system transfer
function is given:
3𝑒 −2𝑠 10(𝑠 − 2)
𝟏. 𝐺(𝑠) = 3 𝟐. 𝑇(𝑠) =
𝑠 + 5𝑠 2 + 9𝑠 + 6 𝑠 5 + 2𝑠 3 + 2𝑠
-----------------------------------------------------------------------------------------
Homework 2.2: The block diagram of a system is shown in Figure 2.12.
Use MATLAB to:
1. Find the transfer function 𝑌(𝑠)/𝑅(𝑠).
2. Determine if the system is stable or not?

Figure 2.12: Multiple feedback system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


28

Homework 2.3: The space satellite shown in Figure 2.13(a), uses a


control system to readjust orientations as shown in Figure 2.13(b).
Perform the following:
1. Determine the range of K. So that the system is stable, then
determine the frequency oscillation.
2. Verify your results using MATLAB.

(a) (b)

Figure 2.13: Control of space satellite.


-----------------------------------------------------------------------------------------
Homework 2.4: For the following system represented in state space,
use MATLAB to find out how many poles are in the left half plane, in
the right half plane, and on the imaginary axis?

2 1 1 0
𝑥̇ (𝑡) = [ 1 7 1 ] 𝑥(𝑡) + [0] 𝑟(𝑡)
−3 4 −5 1

𝑦(𝑡) = [0 1 0] 𝑥(𝑡)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


29

Experiment No. (2)


Root Locus Technique

 Objectives:
The objectives of this experiment are to:
1. Verify the effect of open loop poles and zeros upon the shape of the
Root Locus.
2. Verify the Root Locus as a tool for estimating the effect of open loop
gain upon the transient response of closed loop systems.

 Theory:
The Root Locus is a graphical method for sketching the locus of roots
in the s – plane as a parameter is varied, and can be used to find the
closed loop poles from the open loop poles and the open loop zeros.
This method is a powerful of analysis and design feedback control
systems for stability and transient response.

 Relation Between ζ and System Dominant Poles:

Figure 3.1: Pole plot for underdamped second order system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


30

Notice that the distance from the origin to the pole equals 𝜔𝑛 .

ζ𝜔𝑛
𝑐𝑜𝑠 𝜃 = → ζ = 𝑐𝑜𝑠 𝜃
𝜔𝑛

 Dominant Roots Location


𝑠1,2 = −𝜎 ± 𝑗𝜔𝑑

𝑠1,2 = −𝜁𝜔𝑛 ∓ 𝑗𝜔𝑛 √1 − 𝜁 2


Example 3.1: Consider the system shown in Figure 3.2. Using MATLAB:
1. Draw the Root Locus.
2. Determine the value of K such that the damping ratio 𝜻 of a pair of
dominant complex conjugate closed loop poles is 0.5.
3. Find the gain and frequency of oscillation.
4. Determine the range of K for stability.
5. Evaluate the settling time, peak time, and steady state error.

Figure 3.2: Unity feedback system for Example 3.1

Solution:

The open loop transfer function is:

𝐾
𝐺(𝑠) = , Let 𝐾 = 1
(𝑠 + 2)(𝑠 + 4)(𝑠 + 6)

>> % To plot the Root Locus using MATLAB %

>> x=zpk([],[-2 -4 -6],1);

>> rlocus(x)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


31

System: x
Root Locus Gain: 480
10 Pole: 0.00116 + 6.63i
Damping: -0.000175
Overshoot (%): 100
8 Frequency (rad/sec): 6.63
6
System: x
Gain: 64
4 Pole: -8.33
Imaginary Axis

Damping: 1
2 Overshoot (%): 0 System: x
Frequency (rad/sec): 8.33 Gain: 64
0 Pole: -1.83 + 3.17i
Damping: 0.5
Overshoot (%): 16.3
-2 Frequency (rad/sec): 3.66
-4 System: x
Gain: 64
-6 Pole: -1.83 - 3.17i
Damping: 0.5
-8 Overshoot (%): 16.3
Frequency (rad/sec): 3.66
-10
-16 -14 -12 -10 -8 -6 -4 -2 0 2
Real Axis

Figure 3.3: Root Locus plotting for Example 3.1.

From Figure 3.3:


2. The closed loop poles are: −1.83 ± 𝑗 3.17, and the gain (𝐾) of this
poles is 64. The third closed loop pole at −8.33.
3. Root Locus branches cross the imaginary axis at 𝜔 = ±6.63 rad/sec.
The value of gain (𝐾) at the crossing points is 480.
4. This system is stable for 0 < 𝐾 < 480.

>> % 5. To determine the settling time, peak time, and ess at the gain is 64 %
>> x=zpk([],[-2 -4 -6],64);
>> sys=feedback(x,1);
>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


32

System: sys
Peak amplitude: 0.654
Overshoot (%): 14.4 Step Response
0.7 At time (sec): 1.14
System: sys
0.6 Final Value: 0.571

System: sys
0.5 Settling Time (sec): 2.29
Amplitude

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5
Time (sec)

Figure 3.4: Step response at K=64 for Example 3.1.

From Figure 3.4: the settling time is 2.29 sec, peak time is 1.14 sec, and
steady state error (𝑒𝑠𝑠 = 1 − 0.571 = 0.429).
Example 3.2: The unity feedback system shown in Figure 3.5:

Figure 3.5: Feedback control system of Example 3.2.

Do the following using MATLAB:


1. Plot the Root Locus.
2. Find the location of dominant roots and the value of K that will yield
1.16% overshoot.
3. Determine the range of K for stability.
4. Evaluate the peak time, settling time, and steady state error to a
unit step input.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


33

Solution:

The number of open loop poles equal to the number of open loop zeros.
− ln(𝑂𝑆% /100)
𝑂𝑆% = 1.16% → ζ= = 0.817.
√(𝜋2 +(ln(𝑂𝑆%/100))2

>> % To plot the Root Locus at 𝑲 = 𝟏 using MATLAB %

>> s=tf('s');

>> x=(s+2)*(s+3)/(s*(s+1));

>> rlocus(x)

System: x
Gain: 0.306
Root Locus Pole: -0.97 + 0.683i
1 Damping: 0.817
Overshoot (%): 1.16
0.8 Frequency (rad/sec): 1.19

0.6

0.4
Imaginary Axis

0.2

-0.2

-0.4

-0.6

-0.8

-1
-3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis

Figure 3.6: Root Locus plotting for Example 3.2.

From Figure 3.6:


2. The location of the dominant roots is: −0.97 ± 𝑗0.683, and the gain
K of this roots is 0.306.
3. This system is stable for any value positive of K since all the root
loci lie in the left half s - plane.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


34

>> % 4. To determine the settling time, peak time, and ess at the gain of 0.306 %
>> sys=feedback(0.306*x,1);
>> step(sys)
Step Response
1.2

1.1 System: sys


Final Value: 1
1
System: sys System: sys
0.9 Peak amplitude: 1.02 Settling Time (sec): 3.89
Overshoot (%): 1.87
At time (sec): 3.25
0.8
Amplitude

0.7

0.6

0.5

0.4

0.3

0.2
0 1 2 3 4 5 6
Time (sec)
Figure 3.7: Step response at K=0.306 for Example 3.2.

From Figure 3.7: the peak time is 3.25 sec, settling time is 3.89 sec, and
steady state error equal to zero.
Example 3.3: Given a unity feedback system that has the forward
transfer function:
𝐾 (𝑠 2 − 2𝑠 + 2)
𝐺(𝑠) =
(𝑠 + 1)(𝑠 + 2)
Do the following using MATLAB:
1. Plot the Root Locus.
2. Find the gain K at the 𝑗𝜔 axis crossing.
3. Find the range of K for stability.
4. Estimate the percent overshoot (𝑂𝑆 %), peak time (𝑇𝑃 ), settling
time (𝑇𝑆 ), and steady state error (𝑒𝑠𝑠 ) at the following values of
gains, 𝐊 = 𝟎. 𝟐, 𝟎. 𝟒, and 𝟎. 𝟖.
5. Repeat parts (1) and (4) using SISO Design Tool.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


35

Solution:

It is seen that 𝐺(𝑠) has a pair of complex conjugate zeros at:

𝑠 = −1 + 𝑗 , 𝑠 = −1 − 𝑗

>> % To plot the Root Locus at 𝑲 = 𝟏 using MATLAB %

>> s=tf('s');

>> x=(s^2-2*s+2)/((s+1)*(s+2));

>> rlocus(x)

System: x
Gain: 0.4
Pole: -0.784 + 1.17i Root Locus
1.5 Damping: 0.556
Overshoot (%): 12.3
Frequency (rad/sec): 1.41
System: x
Gain: 0.8
1 Pole: -0.388 + 1.36i
Damping: 0.275
System: x Overshoot (%): 40.7
Gain: 0.2 Frequency (rad/sec): 1.41
0.5 Pole: -1.08 + 0.909i
Damping: 0.766
Imaginary Axis

Overshoot (%): 2.38


Frequency (rad/sec): 1.41
0

-0.5
System: x
Gain: 1.5
Pole: -0.000619 - 1.41i
-1 Damping: 0.000437
Overshoot (%): 99.9
Frequency (rad/sec): 1.41
-1.5
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5
Real Axis

Figure 3.8: Root Locus plotting for Example 3.3.

From Figure 3.8:


1. The Root Locus branches cross the imaginary axis at𝜔 = ±1.41 r/s.
The value of gain K at the crossing points is 1.5.
2. The system is stable for 0 < 𝐾 < 1.5.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


36

>> % 3. To estimate the percent overshoot, peak time, settling time, and steady
state error at the gain, 𝑲 = 𝟎. 𝟐, 𝟎. 𝟒, 𝐚𝐧𝐝 𝟎. 𝟖 on the same graph %
s=tf(‘s’);
K=[0.2 0.4 0.8];
hold on
for i=1:3
x=K(i)*(s^2-2*s+2)/((s+1)*(s+2));
sys=feedback(x,1);
step(sys)
end
gtext('K=0.2')
gtext('K=0.4')
gtext('K=0.8')
Step Response
0.7

0.6

0.5
K=0.8

0.4

K=0.4
0.3
Amplitude

K=0.2
0.2

0.1

-0.1

-0.2
0 2 4 6 8 10 12 14 16 18
Time (sec)

Figure 3.9: Step response for K=0.2, 0.4, and 0.8.


4. By using SISO Design Tool:
1. Write the transfer function of the system in the command window.
2. Write the command (sisotool) for the defined transfer function.
3. From the given window, choose the Root Locus and closed loop
step response only.
4. Move the closed loop poles until the desired gains are achieved,
and then record the performance specifications for each value of
gain.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


37

Performance specifications for each value of gain as shown in


the following table:

Performance
𝐾 = 0.2 𝐾 = 0.4 𝐾 = 0.8
Specifications
𝜁 0.766 0.556 0.275

Closed Loop Poles −1.08 ± 𝑗 0.909 −0.784 ± 𝑗 1.17 −0.388 ± 𝑗 1.36

Overshoot(OS%) 3.03% 16% 55.2%

Peak Time ( Tp ) 4.21 sec 3.54 sec 3.24 sec

Settling Time ( Ts ) 4.69 sec 4.97 sec 10.8 sec

Error(ess ) 0.833 0.714 0.556

What is the effect of the proportional gain on the system performance?


-----------------------------------------------------------------------------------------
Homework 3.1: Consider a non-unity feedback system shown in Figure
3.10. Do the following using MATLAB:
1. Plot the Root Locus, and find the range of K for stability.
2. Find the location of the closed loop dominant poles and value of K
if the system with operating 20% overshoot. Also, find the location
of the third closed loop pole.
3. For K found in (2). Determine the peak time, settling time, and
steady state error to a step input.

Figure 3.10: Non- unity feedback system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


38

Homework 3.2: Consider the system represented in state variable form:

𝑥̇ (𝑡) = 𝐴𝑥(𝑡) + 𝐵𝑢(𝑡)


𝑦(𝑡) = 𝐶𝑥(𝑡) + 𝐷𝑢(𝑡)

Where:
0 𝐾 0 0
𝐴=[ 0 0 1 ], 𝐵 = [0] , 𝐶 = [1 0 0], and 𝐷 = [0]
−15 −23 −9 1

Using MATLAB:
1. Plot the Root Locus(let 𝐊 = 𝟐).
2. For what values of K is the system stable?
-----------------------------------------------------------------------------------------
Homework 3.3: Using MATLAB SISO Design Tool. Set up a negative
unity feedback system with:

𝐾(𝑠 + 6)
𝐺(𝑠) =
𝑠(𝑠 + 0.5)(𝑠 + 10)

1. Plot the Root Locus for the zero at -6. Move the zero to the following
locations, and plot a Root Locus at each location: -2, -1.5, and -1.2
when the damping ratio 𝜁 = 0.456.
2. Record the percent overshoot, peak time, settling time, and steady
state error for each location of zero.
3. Discuss the reasons for any discrepancies. What conclusion can you
draw?
-----------------------------------------------------------------------------------------
Homework 3.4: Laser can be used to drill the hip socket for the
appropriate insertion of an artificial hip joint. The use of lasers for
surgery requires high accuracy for position and velocity response. Let
us consider the system shown in Figure 3.11, which uses a DC motor

Khaled Mustafa Mahmoud Session: Fall 2015/2016


39

manipulator for the laser. The amplifier gain K must be adjusted so that
the steady state error for a ramp input 𝑟(𝑡) = 𝐴𝑡 (where A=1 mm/s),
is less than or equal to 0.1 mm, while a stable response is maintained.
To obtain the steady state error required and a good response, select a
motor with a field time constant 𝜏1 = 0.1 sec, and a motor plus load
time constant 𝜏2 = 0.2 sec.

Figure 3.11: Laser manipulator control system.

Plot the Root Locus and do the following:

1. Find the amplifier gain that yields the steady state error to a ramp
input is less than or equal to 0.1 mm, and obtain the ramp response.
2. For the value of amplifier gain determined in part (1). What is the
location of the closed loop dominant poles?
3. Determine the range of K for stability.
4. For the value of amplifier gain determined in part (1). Determine
the percentage overshoot, peak time, settling time, and steady state
error to a step input.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


40

Experiment No. (3)


Bode Plots

 Objectives:
The objectives of this experiment are to:
1. Plot Bode Diagrams and analyze stability.
2. Examine the relationship between open loop frequency response
and closed loop transient response.
3. Use frequency response to design the gain to meet stability
specification.
 Introduction:
The frequency response of the systems is defined as the response of the
system to a sinusoidal input signal, the output is also sinusoidal signal,
The genesis of the frequency response analysis is to determine the
stability of closed loop systems from the frequency response of the open
loop systems, in the frequency response there are many ways to
determine the stability of a control systems, such as Bode Plot, Nyquist
criterion and Nichols Chart.
 Bode Plot:
Bode Plot is a graphical representation of the transfer function for
determining the stability of a Linear Time Invariant (LTI) systems.
This technique has different advantages in the following situations:

1. When it is hard to sketch the Root Locus, Bode Plot is simple and
accurate.
2. The unknown transfer function of a system can be deduced from the
experimentally determined frequency response of a system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


41

3. When response of the system subjected to undesired noises and


disturbances.
The main disadvantage of the Bode Plot (all frequency response
methods) for analysis and design is the indirect link between the
frequency and the time domain.
The Bode Plot consists of two graphs:
1. The magnitude curve of G(jω) plotted in the versus 𝜔.
2. The phase curve of G(jω) plotted in degrees as a function of 𝜔.
Also, you must be know some parameters in this method:

1. Gain crossover frequency (𝝎𝒄 ): is the frequency at which the


magnitude curve of the system cross the 0 dB.
2. Phase crossover frequency (𝝎𝝅 ): is the frequency when the phase
curve of the system cross -180°.
3. Gain Margin (GM): is the magnitude in dB at which the phase curve
cross the -180°.

GM = 0 − |𝐺(𝑗𝜔)||𝜔
𝜋

4. Phase Margin (PM): is the angle with degree at which the magnitude
curve cross the 0 dB.

PM = ∠𝐺(𝑗𝜔)|𝜔𝑐 − (−180°).

5. Bandwidth(𝝎𝑩𝑾 ): the frequency at which the frequency response


has declined -3 dB from its low frequency value.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


42

Figure 4.1: Gain and phase margins and System bandwidth on the Bode Diagrams.

 Bode Plot Stability Criterion:

The Bode Plot used to determine the stability of control systems. For a
minimum phase system, both phase and gain margins should be
positive or at least the phase margin should be positive for the system
to be stable. A negative phase margin means that the system is unstable.
In other words, when the gain crossover frequency is less than phase
cross over frequency, the system is stable. If the gain crossover
frequency is greater than phase crossover frequency, the system is
unstable. If the gain crossover frequency equals phase crossover
frequency (the gain margin equal to 0 dB and the phase margin is 0°),
the system is marginally stable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


43

Figure 4.2: Gain and phase margins of stable and unstable systems.

Example 4.1: The unity feedback system shown in Figure 4.3:

1000K
𝐺(𝑠) =
𝑠(𝑠 + 5)(𝑠 + 20)

Using MATLAB. Plot the Bode Diagram (let K=1), then determine the
following:
1. Gain and Phase crossover frequencies (𝝎𝒄 & 𝝎𝝅 ).
2. Gain and Phase Margins (GM & PM).
3. Range of K for stability from Bode Plots.
Also, determine the peak time, overshoot, settling time, and steady state
error for the closed loop step response if K = 0.5.

Figure 4.3: Feedback control system of Example 4.1.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


44

Solution:
10
𝐺(𝑗𝜔) =
𝑗𝜔 𝑗𝜔
𝑗𝜔 ( + 1) ( + 1)
5 20
Since, the system has a pole at the origin.

Hence, the starting point at low frequency (𝜔 = 0.1) is given by:


K 10
S. P = 20 log ( ) → S. P = 20 log ( ) = 40 dB.
ω 0.1
The break frequencies are at: 5 and 20 rad/sec.

>> % To plot the Bode diagram of Example 4.1 using MATLAB %

>> s=tf('s');

>> x=1000/(s*(s+5)*(s+20));

>> bode(x)
>> allmargin(x);

Bode Diagram
System: x
50 Gain Margin (dB): 7.96
At frequency (rad/sec): 10
Magnitude (dB)

Closed Loop Stable? Yes


0

-50

-100

-150 System: x
-90 Phase Margin (deg): 22.5
Delay Margin (sec): 0.0647
At frequency (rad/sec): 6.08
Phase (deg)

-135 Closed Loop Stable? Yes

-180

-225

-270
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)

Figure 4.4: Bode Plot diagram of Example 4.1.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


45

From Figure 4.4:

1. The gain crossover frequency (𝜔𝑐 ) equals 6.08 rad/sec, and the phase
crossover frequency (𝜔𝜋 ) equals 10 rad/sec.
2. The Gain Margin (GM) equals 7.96 dB, and the Phase Margin (PM)
equals 22.5°.
Both phase and gain margins are positive, and gain cross over
frequency is less than phase cross over frequency. Therefore, the
system is stable.
3. To determine the range K for stability from Bode Plots:
GM = 20 log K → 7.96 = 20 log K → K = 2.5.
K = 2.5 × 1000=2500 will cause the system to be marginally stable.
Hence, the system is stable if 0 < 𝐾 < 2500.
>> % To determine the peak time, overshoot, settling time, and ess if K = 0.5 %
>> sys=feedback(0.5*x,1)
>> step(sys)

System: sys
Peak amplitude: 1.28 Step Response
Overshoot (%): 27.8
1.4
At time (sec): 0.761

1.2
System: sys System: sys
Settling Time (sec): 2.26 Final Value: 1
1

0.8
Amplitude

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5
Time (sec)

Figure 4.5: Step response of Example 4.1.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


46

From Figure 4.5: the peak time is 0.761 sec, overshoot is 27.8 %, settling
time is 2.26 sec, and the steady state error equals zero.

Example 4.2: Given a unity feedback system that has the forward transfer
function:
8000K
𝐺(𝑠) =
(𝑠 + 2)(𝑠 + 4)(𝑠 + 10)

Using MATLAB. Plot the Bode diagram (let K=1), then determine the
following from the graph:
1. Gain and Phase crossover frequencies.
2. Gain and phase margins.
3. Stability of the system.

Solution:

100
𝐺(𝑗𝜔) =
𝑗𝜔 𝑗𝜔 𝑗𝜔
( 2 + 1) ( 4 + 1) (10 + 1)

Since, the system doesn’t have a pole nor a zero at the origin.

Hence, the starting point is given by:

S. P = 20 log K = 20 log 100 = 40 dB.

The corner frequencies are at: 2, 4, and 10 rad/sec.

>> % To plot the Bode diagram of Example 4.2 using MATLAB %


>> s=tf('s');
>> x=8000/((s+2)*(s+4)*(s+10));
>> bode(x)
>> allmargin(x);

Khaled Mustafa Mahmoud Session: Fall 2015/2016


47

System: x
Bode Diagram Gain Margin (dB): -18
50 At frequency (rad/sec): 8.25
Magnitude (dB) Closed Loop Stable? No

-50

-100
0
Phase (deg)

-90 System: x
Phase Margin (deg): -44.4
Delay Margin (sec): 0.289
-180 At frequency (rad/sec): 19
Closed Loop Stable? No

-270
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)

Figure 4.6: Bode Plot diagram (K=8000) of Example 4.2.

From Figure 4.6:

1. The gain crossover frequency equals to 19 rad/sec, and the phase


crossover frequency equals to 8.25 rad/sec.
2. The gain margin equals to -18 dB, and the phase margin equals to
−44°. So that…
3. The system is unstable. But it can be made stable by reducing the
gain K, where:

GM = 20 log K → − 18 = 20 log K → K = 0.1258.

𝐾 = 0.1258 × 8000 = 1006.4 will cause the system to be marginally


stable. Hence, the system is stable if 0 < 𝐾 < 1006.4.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


48

>> % Let 𝐊 = 800, then plot the Bode diagram %

>> x1=800/((s+2)*(s+4)*(s+10));
>> allmargin(x1);

>> bode(x1)

Bode Diagram System: x1


50 Gain Margin (dB): 2.02
At frequency (rad/sec): 8.25
Closed Loop Stable? Yes
Magnitude (dB)

-50

-100

-150
0
System: x1
Phase (deg)

Phase Margin (deg): 7.11


-90 Delay Margin (sec): 0.0168
At frequency (rad/sec): 7.39
Closed Loop Stable? Yes
-180

-270
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)

Figure 4.7: Bode Plot diagram (K=800) of Example 4.2.

From Figure 4.7:

 The gain crossover frequency equals to 7.39 rad/sec, and the phase
crossover frequency equals to 8.25 rad/sec.
 The gain margin equals to 2.02 dB, and 7.11° phase margin. Hence,
the system is stable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


49

Example 4.3: Use MATLAB LTI Viewer with the Bode Plot for a unity
feedback system with:

50K(𝑠 + 2)
𝐺(𝑠) =
(𝑠 2 + 4𝑠 + 16)

To find the following:


1. Gain and phase crossover frequencies.
2. Gain and phase margins.
3. Stability of the system from Bode Plots.
4. Bandwidth (𝝎𝑩𝑾 ).
Then, obtain the closed loop step response when K =2.

Solution:

𝑗𝜔
6.25 ( + 1)
𝐺(𝑗𝜔) = 2
(𝑗𝜔)2 4𝑗𝜔
( 16 + 16 + 1)

Since, the system doesn’t have a pole nor a zero at the origin.

Hence, the starting point is given by:

S. P = 20 log K → S. P = 20 log 6.25 = 15.91 dB.

𝜔𝑛2 = 16 → 𝜔𝑛 = 4 rad/ sec , 𝜁 = 0.5.

The break frequencies at: 2 and 4 rad/sec.

>> % To plot the Bode diagram of Example 4.3 using MATLAB %


>> s=tf('s');
>> x=50*(s+2)/( s^2+4*s+16);
>> ltiview(x)
>> allmargin(x);

>> bandwidth(x);

Khaled Mustafa Mahmoud Session: Fall 2015/2016


50

Bode Diagram
30
System: x
Frequency (rad/sec): 0.101 System: x
20 Magnitude (dB): 15.9 Frequency (rad/sec): 12.1
Magnitude (dB)

Magnitude (dB): 12.9

10

-10
45
Phase (deg)

0
System: x
Phase Margin (deg): 92.3
-45 Delay Margin (sec): 0.0321
At frequency (rad/sec): 50.2
Closed Loop Stable? Yes
-90
-1 0 1 2
10 10 10 10
Frequency (rad/sec)

Figure 4.8: LTI Viewer with Bode Plot diagram of Example 4.3.

From Figure 4.8:

1. The gain crossover frequency equals 50.2 rad/sec, and the phase
crossover frequency doesn’t exist.
2. The gain margin approaches to infinity, and the phase margin equals
92.3°.
3. Phase margin is positive and phase cross over frequency doesn’t
exist. Therefore, the system is stable for any value of K.
4. The system bandwidth (𝜔𝐵𝑊 at 15.9 − 3 = 12.9 dB) is equal to 12.1
rad/sec.

>> % To obtain the closed loop step response when K =2 using LTI Viewer %
>> sys=feedback(2*x,1);
>> ltiview(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


51

System: sys
Peak amplitude: 0.974
Overshoot (%): 5.21
At time (sec): 0.0675 Step Response System: sys
1
Final Value: 0.926

0.9 System: sys


Settling Time (sec): 0.529
0.8
System: sys
Rise Time (sec): 0.0177
0.7

0.6
Amplitude

0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2
Time (sec)

Figure 4.9: LTI Viewer step response of Example 4.3.

From Figure 4.9: the peak time is 0.0675 sec, overshoot is 5.21%, settling
time is 0.529 sec, and the steady state error (𝑒𝑠𝑠 = 1 − 0.926 = 0.0740).

Example 4.4: The unity feedback (Non-minimum phase) system shown in


Figure 4.10, where:

K(𝑠 − 5)(𝑠 − 15)


𝐺(𝑠) =
(𝑠 + 1)(𝑠 + 10)(𝑠 + 30)
Using MATLAB. Plot the Bode diagram when K = 10, then determine
the following from the graph:
1. Gain and phase crossover frequencies.
2. Gain and phase margin.
3. Stability of the system.
Also, determine the closed loop step response.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


52

Figure 4.10: Feedback control system of Example 4.4.

Solution:

𝑗𝜔 𝑗𝜔
2.5 ( − 1) ( − 1)
𝐺(𝑗𝜔) = 5 15
𝑗𝜔 𝑗𝜔 𝑗𝜔
( 1 + 1) (10 + 1) (30 + 1)

Since, the system doesn’t have a pole nor a zero at the origin.

Hence, the starting point is given by:

S. P = 20 log K → S. P = 20 log 2.5 = 7.96 dB.

The break frequencies are at: 1, 5, 10, 15 and 30 rad/sec.

>> % To plot the Bode diagram of Example 4.4 using MATLAB %

>> s=tf('s');

>> x=10*(s-5)*(s-15)/((s+1)*(s+10)*(s+30));

>> bode(x)

>> allmargin(x)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


53

Bode Diagram
10

0
Magnitude (dB)

-10 System: x
Gain Margin (dB): 3.92
At frequency (rad/sec): 5.1
-20
Closed Loop Stable? Yes

-30
System: x
Phase Margin (deg): 55.2
-40
360 Delay Margin (sec): 0.376
At frequency (rad/sec): 2.56
Closed Loop Stable? Yes
270
Phase (deg)

180

90

-90
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)

Figure 4.11: Bode Plot diagram of Example 4.4.

From Figure 4.11:

1. The gain crossover frequency equals to 2.56 rad/sec, and the phase
crossover frequency equals to 5.1 rad/sec.
2. The gain margin equals to 3.92 dB, and the phase margin equals to
55.2°.
3. In this case, the system is stable.

>> % To determine the closed loop step response %


>> sys=feedback(x,1);
>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


54

System: sys
Peak amplitude: 1.12
Overshoot (%): 57.2 Step Response
At time
1.2 (sec): 0.921

System: sys
0.8 Final Value: 0.714

0.6 System: sys


Settling Time (sec): 3.24
Amplitude

0.4

0.2

-0.2

-0.4
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)

Figure 4.12: Step response of Example 4.4.

From Figure 4.12: the peak time is 0.921 sec, overshoot is 57.2%, settling
time is 3.24 sec, and the steady state error equals 0.286.

Example 4.5: Given a unity feedback system that has the forward transfer
function:
5 K 𝑒 −0.3𝑠
𝐺(𝑠) =
(𝑠 + 1)(𝑠 + 5)

Do the following using MATLAB:


1. Plot the Bode diagram (let K =2).
2. Determine the values of gain and phase crossover frequencies.
3. Find the values of gain and phase Margins.
4. Find the Range of K for stability from Bode Plots.
Then, use SISO Design Tool to determine the closed loop step response
when the gains (K) are: 8, 4.5, and 2.5.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


55

Solution:
2 𝑒 −0.3𝑗𝜔
𝐺(𝑗𝜔) =
𝑗𝜔 𝑗𝜔
( 1 + 1) ( + 1)
5
Since, the system doesn’t have a pole nor a zero at the origin.

Hence, the starting point is given by:

S. P = 20 log K → S. P = 20 log 2 = 6.02 dB.

The corner frequencies at: 1 and 5 rad/sec.

>> % 1. To plot the Bode diagram of Example 4.5 using MATLAB %

>> a=10;

>> b=[1 6 5]; >> s=tf('s');

>> x=tf(a,b,'inputdelay',0.3); >> x=10*exp(-0.3*s)/((s+1)*(s+5));

>> bode(x)

>> allmargin(x);

Bode Diagram
20

0
Magnitude (dB)

-20 System: x
Gain Margin (dB): 8.08
-40 At frequency (rad/sec): 3.88
Closed Loop Stable? Yes
-60

-80

-100
0
System: x
Phase Margin (deg): 75.9
Delay Margin (sec): 0.819
Phase (deg)

-5760
At frequency (rad/sec): 1.62
Closed Loop Stable? Yes
-11520

-17280
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)

Figure 4.13: Bode Plot Diagram of Example 4.5.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


56

From Figure 4.13:

2. The gain crossover frequency equals to 1.62 rad/sec, and the phase
crossover frequency equals to 3.88 rad/sec.
3. The gain margin equals to 8.08 dB, and the phase margin equals to
75.9°. Therefore, the system is stable.
4. To determine the range K for stability from Bode Plots:

GM = 20 log 𝐾 → 8.08 = 20 log 𝐾 → 𝐾 = 2.535.

𝐾 = 2.535 × 5 = 12.675 will cause the system to be marginally stable.


Hence, the system is stable if 0 < 𝐾 < 12.675.

To determine the closed loop step response (at K=8, 4.5, and 2.5) using
SISO Design Tool:

1. Write the transfer function of the system in the command window.


2. Write the command (sisotool) for the defined transfer function.
3. From the given window, choose the Bode Plot and closed loop step
response only.
4. Move the magnitude curve up or down, until the desired gains are
achieved.
5. Record the system characteristics for each value of gain.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


57

System performance for each value of gain as shown in the


following table:

System Performance 𝐾 = 10 𝐾=8 𝐾 = 4.5 𝐾 = 2.5

𝜔𝐶 (rad/sec) 1.62 1.2 --- ---

Gain Margin (dB) 8.08 10 15 20

𝜔𝜋 (rad/sec) 3.88 3.88 3.88 3.88

Phase Margin 75.9° 96° ∞ ∞

Bandwidth (rad/sec) 0.9613 0.9613 0.9613 0.9613

Overshoot(OS%) 29.7 % 20.2 % 4.89 % ---

Peak Time ( Tp ) 1.04 sec 1.15 sec 1.59 sec ---

Settling Time ( Ts ) 3.42 sec 2.75 sec 2.19 sec 1.85 sec

Error(ess ) 0.333 0.384 0.527 0.665

Discuss the effect of the system gain on the system performance.


--------------------------------------------------------------------------------------------
Homework 4.1: Consider the system given in Figure 4.14:
1. If 𝑲𝑰 = 1, find gain margin using Bode Plot. Also, find steady state
error to a ramp input.
2. Using SISO Design Tool. Find 𝑲𝑰 so that gain margin is 5.
3. Corresponding to the 𝑲𝑰 obtained in (2). Find the steady state error
to a ramp input.

Figure 4.14: Speed control system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


58

Homework 4.2: A unity feedback system has an open loop transfer


function, where:

𝐾(𝑠 + 1)
𝐺(𝑠) =
(𝑠 − 1)(𝑠 − 6)
1. Using a Bode diagram for K = 8, determine the system stability.
2. Using SISO Design Tool. Select a gain K so that the phase margin is at
least 45°.
------------------------------------------------------------------------------------------------------------
Homework 4.3: Consider two systems with transfer function:
4 25
𝐺1 (𝑠) = , 𝐺2 (𝑠) =
𝑠 2 + 2𝑠 + 4 𝑠 2 + 5𝑠 + 25
Using MATLAB:

1. Draw the Bode Plot of both systems on the same figure.


2. From the Bode Plot of both systems. Find the Bandwidth (𝝎𝑩𝑾 ).
3. From the closed loop step response. Find percentage overshoot,
rise time, peak time, settling time, and steady state error.
4. What is the effect of bandwidth on time response?
---------------------------------------------------------------------------------------------------------------
Homework 4.4: Consider a unity feedback system with open loop transfer
function, where:
K
𝐺(𝑠) =
𝑠(𝑠 + 1)(𝑠 + 10)
1. If K = 5, draw Bode Plot of 𝐺(𝑠) and find gain and phase margins.
2. Determine the closed loop step response of 𝐺(𝑠).
3. Repeat (1) and (2) if a pure delay with transfer function 𝐷(𝑠) = 𝑒 −1.2𝑠
is also present in the forward path.
4. Compare and discuss the results of the system with and without time
delay.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


59

Experiment No. (4)


Nyquist Criterion

 Objectives:
The objectives of this experiment are to:
1. Plot the Nyquist diagram, and determine the absolute or relative
stability of a system.
2. See the effect of the time delay on the stability and transient response.
 Nyquist Criterion:
The Nyquist criterion is the most effective frequency domain analysis
technique for determining the stability of the linear closed loop control
systems. This criterion is useful in control engineering because the
absolute stability of the closed loop system can be determined
graphically from open loop frequency response curves, and there is no
need for actually determining the closed loop poles. The Nyquist plot
contains of the magnitude of 𝐺(𝑗𝜔) versus the phase angle 𝐺(𝑗𝜔) on
polar coordinates as 𝜔 is varied from zero to infinity.

This technique has different advantages in the following situations:

1. Shows the frequency response characteristics of a system over the


Bode Plot in a single plot.
2. The Nyquist criterion provides us with suitable information
concerning the absolute and relative stability of the system.
3. It has advantage over Root Locus and Routh – Hurwitz because it can
be determine the stability of the system with time delay.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


60

4. In addition, there is a natural generalization to more complex systems


with Multiple Input Multiple Output (MIMO).
One disadvantage of the Nyquist plot, it’s difficult to determine the
frequencies value, because the Nyquist plot has been plotted as
Magnitude vs. Phase Plot.
The Nyquist criterion provides us with two relative stability measures:
gain margin and phase margin.
Gain Margin (GM): is the increase in the system gain when phase equal
to −180° that will result in a marginally stable system with intersection
of the (−1 + 𝑗0) point on the Nyquist diagram.

1
𝐺𝑀 = 20 log (dB)
|𝑎|

Phase Margin (PM): the angular difference between the point on the
frequency response at the unit circle crossing and −180°.
Another meaning: phase margin is the amount of phase shift at unity
magnitude that will result in a marginally stable system with intersection
of the(−1 + 𝑗0) point on the Nyquist diagram.

PM = ∠𝐺(𝑗𝜔)|𝜔𝑐 − (−180°).

Also, you must be know some parameters in this method:


Phase crossover frequency (𝝎𝝅 ): the frequency where it crosses the
negative real axis.
Gain crossover frequency (𝝎𝒄 ): the frequency where it intersect the
Nyquist diagram to unit circle.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


61

Figure 5.1: Gain and phase margins on the Nyquist Diagram.

 Stability of Nyquist Criterion:


The Nyquist diagram used to determine the stability of Linear closed loop
control systems. This criterion is defined in terms of the (−1 + 𝑗0) point
on the Nyquist diagram.
1. When the plot passes before the point (−1 + 𝑗0) the gain and phase
margins are positive, it means that the system is stable.
2. When the plot passes after the point (−1 + 𝑗0) the gain and phase
margins are negative, it means that the system is unstable.
3. When the plot passes through the point (−1 + 𝑗0) the gain and phase
margins are zero, it means that the system is marginally stable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


62

Stable System Unstable System

Figure 5.2: Gain and phase margins of stable and unstable systems.

Example 5.1: The open loop transfer function of a unity feedback system is:

45 K
𝐺(𝑠) =
(𝑠 + 3)(𝑠 + 6)

Using MATLAB. Plot the Nyquist diagram if K = 2, then determine the


following from the graph:
1. Gain and Phase crossover frequencies (𝝎𝒄 & 𝝎𝝅 ).
2. Gain and Phase Margins (GM & PM).
3. Stability of the system.

Also, determine the peak time, overshoot, settling time, and steady state
error for the closed loop step response.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


63

Solution:

90 5
𝐺(𝑠) = → 𝐺(𝑗𝜔) =
(𝑠 + 3)(𝑠 + 6) 𝑗𝜔 𝑗𝜔
( 3 + 1) ( 6 + 1)

90
|𝐺(𝑗𝜔)| =
√𝜔 2 + 9 √𝜔 2 + 36

𝜔 𝜔
∠𝐺(𝑗𝜔) = − tan−1 ( ) − tan−1 ( )
3 6

lim |𝐺(𝑗𝜔)| = 5 lim ∠𝐺(𝑗𝜔) = 0°


𝜔→0 𝜔→0

lim |𝐺(𝑗𝜔)| = 0 lim ∠ 𝐺(𝑗𝜔) = −180°


𝜔→∞ 𝜔→∞

>> % To plot the Nyquist diagram of Example 5.1 using MATLAB %

>> s=tf('s');

>> x=90/((s+3)*(s+6));

>> nyquist(x)

>> allmargin(x)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


64

Nyquist Diagram

1
System: x
Imaginary Axis

Phase Margin (deg): 55.9


Delay Margin (sec): 0.118
0
At frequency (rad/sec): 8.28
Closed Loop Stable? Yes

-1

-2

-3

-1 0 1 2 3 4 5
Real Axis

Figure 5.3: Nyquist diagram of Example 5.1.

From Figure 5.3:

1. The gain crossover frequency (𝜔𝑐 ) equals 8.28 rad/sec, and the phase
crossover frequency (𝜔𝜋 ) doesn’t exist.
2. The Gain Margin (GM) approaches infinity, and the Phase Margin (PM)
equals 55.9°.
3. Since, phase margin is positive and phase cross over frequency doesn’t
exist. Therefore, the system is stable for any value of K.

>> % To determine the peak time, overshoot, settling time, and ess %
>> sys=feedback(x,1);
>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


65

Step Response
1.4

System: sys
1.2 Peak amplitude: 1.02
Overshoot (%): 22.1
At time (sec): 0.338

1
System: sys
Final Value: 0.833

0.8
Amplitude

System: sys
Settling Time (sec): 0.807
0.6

0.4

0.2

0
0 0.5 1 1.5
Time (sec)

Figure 5.4: Step response of Example 5.1.

From Figure 5.4: the peak time is 0.338 sec, overshoot is 22.1 %, settling
time is 0.807 sec, and the steady state error equals 0.167.
Example 5.2: Use MATLAB LTI Viewer with the Nyquist diagram for a
unity feedback system with:

100 𝐾
𝐺(𝑠) =
𝑠(𝑠 + 2)(𝑠 + 3)

To find the following:


1. Gain and phase crossover frequencies.
2. Gain and phase margins.
3. Stability of the system from Nyquist diagram.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


66

Solution:
100 𝐾
𝐺(𝑠) =
𝑠(𝑠 + 2)(𝑠 + 3)

>> % To plot Nyquist diagram of Example 5.2 when K = 1 using MATLAB LTI Viewer %
>> s=tf('s');

>> x=100/(s*(s+2)*(s+3));

>> ltiview(x)

Nyquist Diagram
3

2
System: x
Phase Margin (deg): -28.8
Delay Margin (sec): 1.38
1 System: x At frequency (rad/sec): 4.19
Gain Margin (dB): -10.5 Closed Loop Stable? No
At frequency (rad/sec): 2.45
Imaginary Axis

Closed Loop Stable? No


0

-1

-2

-3
-7 -6 -5 -4 -3 -2 -1 0 1 2
Real Axis

Figure 5.5: LTI Viewer with Nyquist diagram for K = 100 of Example 5.2.

From Figure 5.5:

1. The gain crossover frequency equals to 4.19 rad/sec, and the phase
crossover frequency equals to 2.45 rad/sec.
2. The gain margin equals to −10.5 dB, and the phase margin equals to
−28.8°.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


67

3. Since, the Nyquist plot passes after the point (−1 + 𝑗0) the gain and
phase margins are negative, it means that the system is unstable.
But it can be made stable by reducing the value of gain K, where:

GM = 20 log K → − 10.5 = 20 log K → K = 0.3.

𝐾 = 0.3 × 100 = 30 will cause the system to be marginally stable. Hence,


the system is stable if 0 < 𝐾 < 30.
Let K = 20, then plot the Nyquist diagram:

20
𝐺(𝑠) =
𝑠(𝑠 + 2)(𝑠 + 3)
>> % To plot Nyquist diagram when K=20 %
>> x1=20/(s*(s+2)*(s+3));
>> ltiview(x1)

Nyquist Diagram
2 System: x1
System: x1
Phase Margin (deg): 11.9
Gain Margin (dB): 3.52
1 Delay Margin (sec): 0.105
At frequency (rad/sec): 2.45
At frequency (rad/sec): 1.98
Closed Loop Stable? Yes
Closed Loop Stable? Yes
0

-1
Imaginary Axis

-2

-3

-4

-5

-6

-7
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Real Axis

Figure 5.6: LTI Viewer with Nyquist diagram for K = 20 of Example 5.2.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


68

From Figure 5.6:

 The gain crossover frequency equals 1.98 rad/sec, and the phase
crossover frequency equals 2.45 rad/sec.
 The gain margin equals 3.52 dB, and the phase margin equals 11.9°.
Therefore, the system is stable.

Example 5.3: Given a unity feedback system that has the forward transfer
function:
15 𝑒 −0.5𝑠
𝐺(𝑠) =
(𝑠 + 1)(𝑠 2 + 4𝑠 + 10)

Using MATLAB (SISO Design Tool). Plot the Nyquist diagram, then
determining the following from the graph:
1. Gain and phase crossover frequencies.
2. Gain and phase margins.
3. Range of K for stability from Nyquist diagram.
4. The closed loop response of the system for 𝑟(𝑡) = 𝑢(𝑡).

Solution:

15 𝑒 −0.5𝑠
𝐺(𝑠) =
(𝑠 + 1)(𝑠 2 + 4𝑠 + 10)

To plot the Nyquist diagram and closed loop step response using MATLAB
SISO Design Tool:
1. Write the transfer function of the system in the command window.
2. Write the command (sisotool) for the defined transfer function.
3. From the given window, choose the open loop Nyquist and closed loop
step response only.
4. Record the required system characteristics from the given figures.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


69

Nyquist Diagram

0.5
System: x
Gain Margin (dB): 3.83
At frequency (rad/sec): 2.09
Imaginary Axis

Closed Loop Stable? Yes


0

System: x
-0.5 Phase Margin (deg): 69.8
Delay Margin (sec): 1.05
At frequency (rad/sec): 1.15
Closed Loop Stable? Yes

-1

-1 -0.5 0 0.5 1 1.5


Real Axis

Figure 5.7: SISO Design Tool with Nyquist diagram of Example 5.3.

From Figure 5.7:

1. The gain crossover frequency equals to 1.15 rad/sec, and the phase
crossover frequency equals to 2.09 rad/sec.
2. The gain margin equals to 3.83 dB, and the phase margin equals to
69.8°. Therefore, the system is stable.
3. To determine the range K for stability from Nyquist diagram:

GM = 20 log K → 3.83 = 20 log K → K = 1.556.

K = 1.556 × 15= 23.35 will cause the system to be marginally stable.


Hence, the system is stable if 0 < 𝐾 < 23.35.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


70

4. The step response for the closed loop system:


Step Response
1

System: sys
0.9
Peak amplitude: 0.969
Overshoot (%): 61.6
0.8 At time (seconds): 2.16

0.7 System: sys


Final value: 0.6
0.6
Amplitude

System: sys
0.5 Settling time (seconds): 13.6

0.4

0.3

0.2

0.1

0
0 2 4 6 8 10 12 14 16 18 20
Time (seconds)

Figure 5.8: Closed loop step response of Example 5.3.

From Figure 5.8: the peak time is (2.16 − 0.5 = 1.66 sec), overshoot is 61.6 %,
settling time is (13.6 − 0.5 = 13.1 sec), and the steady state error equals 0.4.
Comparison the performance of the system with and without time delay:

System Performance System without T. D System with T. D


𝜔𝐶 (rad/sec) 1.15 1.15
𝜔𝜋 (rad/sec) 3.74 2.09
Gain Margin (dB) 12 3.83
Phase Margin 103° 69.8°
Overshoot(OS%) 20.7 % 61.6 %
Peak Time ( Tp ) 1.51 sec 1.66 sec
Settling Time ( Ts ) 4.03 sec 13.1 sec
Error(ess ) 0.4 0.4

What is the effect of the time delay on the system performance?

Khaled Mustafa Mahmoud Session: Fall 2015/2016


71

Homework 5.1: Given a unity feedback system that has the forward
transfer function:
101 𝐾
𝐺(𝑠) =
𝑠(1 + 0.1𝑠)(1 + 0.001𝑠)

Using MATLAB LTI Viewer:


1. Plot the Nyquist diagram if K =10.
2. Find the values of gain and phase crossover frequencies.
3. Determine the gain margin and phase margin.
4. Is the system stable? Why?
----------------------------------------------------------------------------------------------
Homework 5.2: A unity feedback control system shown in Figure 5.9 has
a forward transfer function:

𝐾
𝐺(𝑠) =
𝑠(𝑠 + 2)(𝑠 + 50)

Using MATLAB SISO Design Tool:


1. Determine the phase margin and gain margin when K = 1300.
2. Select a gain K so that the phase margin of the system is 50°.
3. For K obtained in part (2), determine the gain margin.
4. Find the range of K for stability from Nyquist Plot.

Figure 5.9: Unity feedback control system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


72

Homework 5.3: A control system for a chemical concentration control


system shown in Figure 5.10. The system receives a granular feed of varying
composition, and we want to maintain a constant composition of the output
mixture by adjusting the feed flow valve. The transfer function of the tank
and output valve is:
5 𝐾𝐼
𝐺(𝑠) = , and that of the controller is 𝐺𝐶 (𝑠) = 𝐾𝑃 +
5𝑠 + 1 𝑠
The transport of the feed along the conveyor requires a transport (or delay)
time, T = 1.5 sec. Using MATLAB:
1. Draw the Nyquist diagram when 𝑲𝑰 = 𝑲𝑷 = 𝟏 , and investigate the
stability of the system.
2. Repeat Part (1) when 𝑲𝑰 = 𝟎. 𝟏 , and 𝑲𝑷 = 𝟎. 𝟎𝟒.
3. When 𝑲𝑰 = 𝟎 , calculate the maximum allowable gain 𝑲𝑷 for the system
to remain stable.

Figure 5.10: Chemical concentration control.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


73

Experiment No. (5)


Nichols Chart

 Objectives:
The objectives of this experiment are to:
1. Plot the Nichols Chart, and determine the closed loop stability of a
system.
2. Determine the characteristics of the closed loop frequency response
from the open loop frequency response.
3. Use frequency response to design the gain to meet stability
specification.

 Nichols Chart:

Nichols Chart is another form of the frequency domain plot. This Chart
consist of two axes. X – axis which represent the phase (degrees), and Y –
axis which represent the magnitude (dB), and contains of the M and N loci.
The plot of Nichols is magnitude against phase. The Nichols Chart is
symmetric about the −180° axis. It is useful for determining the
frequency response of the closed loop from that of the open loop. Where
any intersections of the open loop frequency response curve 𝐺(𝑗𝜔) and
the M and N give the values of the magnitude M and phase angle N of the
closed loop frequency response at each frequency point.

From this Chart, we can determine the following:


Phase crossover frequency (𝝎𝝅 ): the frequency where the Nichols
trajectory intersect the 0 dB.
Gain crossover frequency (𝝎𝒄 ): the frequency where the Nichols
trajectory intersects the −180°.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


74

Phase Margin (PM): is the horizontal distance measured in degrees from


the gain crossover frequency to the −180°.
Gain Margin (GM): is the vertical distance in dB measured from the phase
crossover frequency to the 0 dB.
Bandwidth ( 𝝎𝐁𝐖 ): the bandwidth of the closed loop system is the
frequency at which the 𝐺(𝑗𝜔) curve intersects M = −3 dB locus.

Figure 6.1: Gain and phase margins on the Nichols Chart.

Stability of Nichols Chart:

The Nichols Chart used to determine the stability of control systems just
like the Bode Plot.
1. If both the gain and phase margins are positive (𝜔𝑐 < 𝜔𝜋 ), the system
is stable.
2. If the gain margin and phase margin are negative (𝜔𝑐 > 𝜔𝜋 ) or at least
the phase margin is negative. It means that, the system is unstable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


75

3. If the gain crossover frequency equals to phase crossover frequency


(gain margin equals 0 dB and phase margin equals 0°). It means that,
the system is marginally stable.

Stable System Unstable System

Figure 6.2: Gain and phase margins of stable and unstable systems.

Example 6.1: Given a unity feedback system that has the forward transfer
function:
5K
𝐺(𝑠) =
𝑠(𝑠 + 2)(𝑠 + 4)
Using MATLAB. Plot the Nichols Chart when 𝐊 = 𝟐, then determine the
following from the graph:
1. Gain and phase crossover frequencies (𝝎𝒄 & 𝝎𝝅 ).
2. Gain and phase Margins (GM & PM).
3. Range of K for stability from the Nichols Chart.
4. Steady state error of closed loop system to a ramp input.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


76

Solution:

>> % To plot the Nichols Chart of Example 6.1 using MATLAB %


>> % G(s)=10/(s(s+2)(s+4)) %
>> s=tf('s');
>> x=10/(s*(s+2)*(s+4));
>> nichols(x)
>> allmargin(x)

Nichols Chart
40

20
System: x
Gain Margin (dB): 13.6
0 At frequency (rad/sec): 2.83
Closed Loop Stable? Yes
System: x
Phase Margin (deg): 47
Open-Loop Gain (dB)

-20 Delay Margin (sec): 0.77


At frequency (rad/sec): 1.07
Closed Loop Stable? Yes
-40

-60

-80

-100

-120
-270 -225 -180 -135 -90
Open-Loop Phase (deg)

Figure 6.3: Nichols Chart plot of Example 6.1.

From Figure 6.3:

1. The gain crossover frequency (𝜔𝑐 ) equals 1.07 rad/sec, and the phase
crossover frequency (𝜔𝜋 ) equals 2.83 rad/sec.
2. The gain margin equals 13.6 dB, and the phase margin equals 47°.
Therefore, the system is stable.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


77

3. To determine the range K for stability from Nichols Chart:

GM = 20 log K → 13.6 = 20 log K → K = 4.786.

K = 4.786 × 10 = 47.86 will cause the system to be marginally stable.


Hence, the system is stable if 0 < 𝐾 < 47.86.

>> % 4. To determine the steady state error of closed loop system to a ramp input %
>> sys=feedback(x,1);
>> t=0:1:10;
>> r=t;
>> lsim(sys,r,t)
Input: In(1)
Peak amplitude: 10
Linear Simulation Results At time (sec): 10
10

9
System: sys
Peak amplitude: 9.2
8
At time (sec): 10

6
Amplitude

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)

Figure 6.4: Steady state error to a ramp input of Example 6.1.

From Figure 6.4: 𝑟(10) = 10 , and 𝑦(10) = 9.2.

The steady state error at 𝑡 = 10 sec ⟹ 𝑒𝑠𝑠 = 10 − 9.2 = 0.8.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


78

Example 6.2: Given a unity feedback system that has the open loop
transfer function:

101 𝐾
𝐺(𝑠) =
𝑠(1 + 0.1𝑠)(1 + 0.001𝑠)

Using MATLAB LTI Viewer. Plot the Nichols Chart if K =10, then do the
following:

1. Find the values of gain and phase crossover frequencies.


2. Determine the gain margin and phase margin.
3. Investigate the stability of the system.

Solution:

>> % To plot the Nichols Chart when K = 10 using MATLAB LTI Viewer %
>> % G(s)=1010/(s(1+0.1s)(1+0.001s)) %

>> s=tf('s');

>> x=1010/(s*(1+0.1*s)*(1+0.001*s));

>> ltiview(x)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


79

Nichols Chart
100

50 System: x
Gain Margin (dB): 8.02e-015
At frequency (rad/sec): 100
Closed Loop Stable? Yes
Open-Loop Gain (dB)

0
System: x
Phase Margin (deg): 0.00198
Delay Margin (sec): 3.46e-007
At frequency (rad/sec): 100
-50
Closed Loop Stable? Yes

-100

-150
-270 -225 -180 -135 -90
Open-Loop Phase (deg)

Figure 6.5: LTI Viewer with Nichols Chart of Example 6.2.

From Figure 6.5:

1. The gain crossover frequency and phase crossover frequency are


equals to 100 rad/sec.
2. The gain margin is 0 dB, and the phase margin is 0° approximately. So
that…
3. The system is marginally stable.

>> % To obtain the closed loop step response of the system %


>> sys=feedback(x,1);
>> step(sys)

Khaled Mustafa Mahmoud Session: Fall 2015/2016


80

Step Response
2

1.8

1.6

1.4

1.2
Amplitude

0.8

0.6

0.4

0.2

0
0 0.05 0.1 0.15 0.2 0.25 0.3
Time (sec)

Figure 6.6: Closed loop step response of Example 6.2.

Example 6.3: Given a unity feedback system that has the forward transfer
function:
𝐾
𝐺(𝑠) =
(𝑠 + 1)(𝑠 + 2)(𝑠 + 5)

Using MATLAB (SISO Design Tool). Plot the Nichols Chart when 𝐊 = 𝟐𝟎,
then do the following:
1. Find the gain and phase margins.
2. Determine the system bandwidth (𝝎𝑩𝑾 ).
3. Find the closed loop step response of the system.
4. Repeat the previous parts when 𝐊 = 𝟑𝟎 and 𝟓𝟎.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


81

Solution:

To plot the Nichols Chart and closed loop step response of the system when
K=20 using MATLAB SISO Design Tool:
1. Write the transfer function of the system in the command window.
2. Write the command (sisotool) for the defined transfer function.
3. From the given window, choose the Nichols Chart and closed loop step
response only.
4. Record the required system characteristics from the given figures.
Nichols Chart
40
System: x
Phase Margin (deg): 80.7 System: x
20 Delay Margin (sec): 1.1 Peak gain (dB): 6.02
At frequency (rad/sec): 1.29 Frequency (rad/sec): 2e-012
Closed Loop Stable? Yes
0
System: x
Gain (dB): 3.02
Open-Loop Gain (dB)

-20 Phase (deg): -70.6


System: x Frequency (rad/sec): 0.816
Gain Margin (dB): 16
-40 At frequency (rad/sec): 4.12
Closed Loop Stable? Yes

-60

-80

-100

-120
-270 -225 -180 -135 -90 -45 0
Open-Loop Phase (deg)

Figure 6.7: SISO Design Tool with Nichols Chart of Example 6.3.

From Figure 6.7:

1. The gain margin equals 16 dB, and the phase margin equals 80.7°.
2. The system bandwidth ( 𝜔𝐵𝑊 at 6.02 − 3 = 3.02 dB ) is equal to
0.816 rad/sec.
3. The closed loop step response of the system shown in Figure 6.8:

Khaled Mustafa Mahmoud Session: Fall 2015/2016


82

Step Response
0.8
System: sys System: sys
Peak amplitude: 0.794 Final Value: 0.667
0.7
Overshoot (%): 19.1
At time (sec): 1.75
0.6 System: sys
Settling Time (sec): 3.89

0.5
Amplitude

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)

Figure 6.8: Closed loop step response (SISO Design Tool) of Example 6.3.

5. Using SISO Design Tool, move the Nichols loci until the desired gains
are achieved, and then record the system performance for each value
of gain. The system characteristics for different values of gain K are
illustrated in the following table.

System Performance 𝐾 = 20 𝐾 = 30 𝐾 = 50
𝜔𝑐 (rad/sec) 1.29 1.82 2.56
Gain Margin (dB) 16 12.5 8
𝜔𝜋 (rad/sec) 4.12 4.12 4.12
Phase Margin 80.7° 56.4° 32°
Bandwidth (rad/sec) 0.816 0.816 0.816
Overshoot (OS%) 19.1% 29.8% 47.6%
Peak Time ( Tp ) 1.75 sec 1.49 sec 1.22 sec
Settling Time ( Ts ) 3.89 sec 4.54 sec 5.89 sec
Error(ess ) 0.33 0.25 0.166

What is the effect of the proportional gain on the system performance?

Khaled Mustafa Mahmoud Session: Fall 2015/2016


83

Homework 6.1: Consider the single input single output system described
by:
𝑥̇ (𝑡) = 𝐴𝑥(𝑡) + 𝐵𝑢(𝑡)

𝑦(𝑡) = 𝐶𝑥(𝑡) + 𝐷𝑢(𝑡)

0 1 0
Where: 𝐴 = [ ] , 𝐵 = [ ] , 𝐶 = [6 3] , 𝐷 = [0]
5+𝐾 −2 1

Using MATLAB. Plot the Nichols Chart for 𝐊 = 𝟏, 𝟐, 𝐚𝐧𝐝 𝟏𝟎, then do the
following:
1. Record the phase margins and the location of the closed loop poles.
2. Compute the bandwidth of the system. As the gain K increases, does
the bandwidth increase or decrease?
3. Plot the step response of the system for each value of K on the same
figure, and explain any differences.
--------------------------------------------------------------------------------------------
Homework 5.2: Consider a unity feedback system as shown in Figure 6.9,
where:
100
𝐺(𝑠) =
𝑠(𝑠 + 1)

Figure 6.9: Unity feedback system of Homework 6.2.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


84

1. Find the phase margin if the system is stable for time delay of 0, 3,
and 7 second.
2. Find the gain margin if the system is stable for each time delays given
in part (1).
3. For what time delays mentioned in part (1) is the system stable?
4. For each time delay that makes the system unstable. How much
reduction in gain is required for the system to be stable?
--------------------------------------------------------------------------------------------
Homework 6.3: A controller is used to regulate the temperature of a
model for plastic part fabrication, as shown in Figure 6.10. The value of
the delay time is estimated as 1.2 sec.

1. Using the Nichols Chart, determine the stability of the system for
𝑲𝒂 = 𝑲 = 𝟏.
2. Determine a suitable value for 𝑲𝒂 for a stable system that will yield a
phase margin greater than 50° when 𝑲 = 𝟏.

Figure 6.10: Temperature controller system.

Khaled Mustafa Mahmoud Session: Fall 2015/2016


85

Homework 6.4: The Manutec robot has large inertia and arm length
resulting in a challenging control problem, as shown in Figure 6.11(a).
The block diagram model of the system is shown in Figure 6.11(b). The
plant dynamics are represented by:

25
𝐺(𝑠) =
(𝑠 + 2)(𝑠 + 4)(𝑠 + 5)

And that of the controller is 𝑮𝒄 (𝒔) = 𝑲 = 𝟒 . Using MATLAB SISO Design


Tool. Find the phase margin required for closed loop step responses with
the following percentages of overshoot: 5%, 10%, 20%, and 30%.

(a) (b)

Figure 6.11: (a) Manutec robot, (b) Block diagram

Khaled Mustafa Mahmoud Session: Fall 2015/2016

You might also like