You are on page 1of 10

International Islamic University, Islamabad

Faculty of Engineering and Technology


Iqra College of Technology

Control Technology Lab

LAB EXPERIMENT # 08: Stability Analysis using MATLAB

Name of Student: …………………………………………

Registration No.: ……………………………………………

Section: …………………………………………………………

Date of Experiment: …………………………………………

Marks obtained: ………………………………………

Remarks: …………………………………………………

Instructor’s Signature: ……………………………...


Lab08: Stability Analysis using MATLAB

Lab Experiment 08: Stability Analysis using MATLAB

Objectives: The objectives of this lab are to analyze the stability of the system with Routh-
Hurwitz criterion when transfer function of the system is known. How can we check the
stability of the system when its State Space Model is given?

Stability Analysis Overview:


If the total response of an LTI system is
𝑐(𝑡) = 𝑐𝑛 (𝑡) + 𝑐𝑓 (𝑡),
then the system will be stable if
𝑐𝑛 (𝑡) → 0, when 𝑡 → ∞
An LTI system will be unstable if 𝑐𝑛 (𝑡) grows without bound as time approaches to infinity.
LTI system will be marginally stable if 𝑐𝑛 (𝑡) neither decay nor grows but remain constant or
oscillates as time approaches to infinity. If the natural response of the LTI system approaches
to zero as time goes to zero then the system will be Stable.
How do we determine that the system is stable? If all closed loop pole is in left half plane,
then the system will be stable, and if the closed loop pole is in right half plane, then the
system will be unstable. The system will be marginally stable if the closed loop lies at the
imaginary axis of s-plane. We will check the stability of the system using Routh-Hurwitz
Criterion and State Space method.
1
Mathematically, when 𝐹(𝑠) = 𝑠+𝑎 then𝑓(𝑡) = 𝑒 −𝑎𝑡 𝑢(𝑡), so for a system to be stable the ‘a’
has to be a positive number only then the pole will be on left half plane and exponential will
decay with time 𝑡 → ∞.

Routh-Hurwitz Criterion:
By this method we can find the number of poles in each section of the s-plane, but we cannot
find their exact coordinates in s-plane.
Generating Routh Table
Consider the closed-loop transfer function of a system is given by

We first create the initial layout for Routh table shown in Table 11.1below

Table 11.1: Routh Table

Control Systems Lab (EE 360 L) Page 2


Lab08: Stability Analysis using MATLAB

The complete Routh Table is shown in Table 11.2 below:

Table 11.2: Complete Routh Table

Example 1: Now consider the closed loop system given in Figure 11.3 (a). Create a Routh
Table for the system shown in Figure 11.3(a) and analyze its stability.

Figure 11.3: Closed Loop System

Solution: First, we have to find the equivalent closed-loop system because we want to test
the denominator of this function. Using feedback formula, we obtain the equivalent system
in Figure 11.3(b). Then we create the initial layout of Routh table and Table 11.3 is the
completed Routh table.

Table 11.3: Complete Routh Table of Example 1


Interpreting the Basic Routh Table
The Routh-Hurwitz criterion declares that the number of roots of the polynomial that are in
the right half-plane is equal to the number of sign changes in the first column.

Control Systems Lab (EE 360 L) Page 3


Lab08: Stability Analysis using MATLAB

If the closed-loop transfer function has all poles in the left half of the s-plane, the system is
stable. Thus, a system is stable if there are no sign changes in the first column of the Routh
table.
For example, Table 11.3 has two sign changes in the first column. The first sign change
occurs from 1 in the s2 row to –72 in the s1 row. The second occurs from –72 in the s1 row to
103 in the s0 row. Thus, the system of Figure 11.1(a) is unstable since two poles exist in the
right half of the s-plane.

Routh-Hurwitz Criterion: Special Cases

Two special cases can occur:


 The Routh table sometimes have a zero only in the first column of a row.
 The Routh table sometimes will have an entire row that consists of zeros.

Zero Only in the First Column


If the first element of a row is zero, division by zero would be required to form the next row.
To avoid this phenomenon, an epsilon𝜖, is assigned to replace the zero in the first column.
The value 𝜖 is then allowed to approach zero from either the positive or negative side, after
which the signs of the entries in the first column can be determined.

Example 2: Determine the stability of the closed-loop transfer function given below.
10
T (s) 
s  2 s  3s 3  6 s 2  5s  3
5 4

Solution: The completed Routh table is shown in Table 11.4a.

Table 11.4a: Routh Table for Example 3

Table 11.4b shows the first column of Table 11.4a, along with the resulting signs for a
choice of 𝜖 positive and 𝜖 negative.

Control Systems Lab (EE 360 L) Page 4


Lab08: Stability Analysis using MATLAB

Table 11.4b: Routh Table 1st columns sign with 𝜖 + and –

Conclusion: We can see, if we choose 𝜖 positive or negative, Table 11.4b will show two
sign changes for both conditions. Hence, the system is unstable and has two poles in the right
half-plane.

Entire Row is Zero


We will now look at the special case. Sometimes while making Routh table, we find that an
entire row consists of zeros because there is an even polynomial that is a factor of the
original polynomial. This case must be handled differently from the case of a zero in only
first column of a row. Let us look at an example that demonstrates how to construct and
interpret the Routh table when an entire row of zeros is present.

Example 3: Determine the number of right-half-plane poles in the closed-loop transfer


function.
10
T (s) 
s 5  7 s 4  6s 3  42s 2  8s  56
Solution:
Start by forming the Routh Table shown in Table 11.5 for the denominator of T(s). We stop
at 3rd row, since the entire row consists of zeros, and the use the following procedure.

Table 11.5: Routh Table of Example 5

Control Systems Lab (EE 360 L) Page 5


Lab08: Stability Analysis using MATLAB

At the second row, we multiply through by 1/7 for convenience.


At third row, we can see that the entire row consists of zeros, so we use the following
procedure:
1. Return to the row above the row of zeros, form the auxiliary polynomial using the
entries in that row as coefficients. The polynomial will start with the power of s in
the label column and continue by skipping every other power of s. Thus the
polynomial formed for this example is 𝑃(𝑠) = 𝑠 4 + 6𝑠 2 + 8.
2. Next, we differentiate the polynomial with respect to s and obtain
𝑑 𝑃(𝑠)
= 𝑠 3 + 12𝑠 + 0
𝑑𝑠
3. Finally, we use the coefficients of this differentiate equation to replace the row of
zeros.
4. For convenience, we multiplied the third row by 1/4.
There are no right-half-plane poles. For the case of zeros row, some of the roots could be on
the jw-axis. If we do not have a row of zeros, we cannot possibly have jw roots.

Control Systems Lab (EE 360 L) Page 6


Lab08: Stability Analysis using MATLAB

Example 4: Write a Generic Matlab Code that takes the characteristic polynomial of system
as an input and display the Roots, Routh Table, number of poles in right half plane and
System’s stability.
Solution:
%==========================================================================
% Routh-Hurwitz Stability Criterion
%==========================================================================

clc;
disp(' ')
D=input('Input coefficients of characteristic equation, i.e:[an an-1 an-2
... a0]= ');
L=length (D);

disp(' ')
disp('----------------------------------------')
disp('Roots of characteristic equation are: '),
disp(roots(D));

%%=======================Program Begin==========================

% --------------------Begin of Building array------------------------------

if mod(L,2)==0
m=zeros(L,L/2);
[rows,cols]=size(m);
for i=1:cols
m(1,i)=D(1,(2*i)-1);
m(2,i)=D(1,(2*i));
end
else
m=zeros(L,(L+1)/2);
[rows,cols]=size(m);
for i=1:cols
m(1,i)=D(1,(2*i)-1);
end
for i=1:((L-1)/2)
m(2,i)=D(1,(2*i));
end
end

for j=3:rows

if m(j-1,1)==0
m(j-1,1)=0.001;
end

for i=1:cols-1
m(j,i)=(-1/m(j-1,1))*det([m(j-2,1) m(j-2,i+1);m(j-1,1) m(j-
1,i+1)]);
end
end

disp('--------The Routh-Hurwitz array is:--------'),disp(m);


% --------------------End of Bulding array--------------------------------

Control Systems Lab (EE 360 L) Page 7


Lab08: Stability Analysis using MATLAB

% Checking for sign change


signMat=sign(m);a=0;
for j=1:rows
a=a+signMat(j,1);
end
if a==rows
disp(' ----> System is Stable <----')
else
disp(' ----> System is Unstable <----')
end

% Calculating Number of Sign Changes


rhpPoles=0;
for k=1:rows-1,
if(signMat(k,1)~=signMat(k+1,1)),
rhpPoles=rhpPoles+1;
end
end

disp(sprintf('--> There are %2d Poles in Right Half Plane <-- ',rhpPoles))

%=======================Program Ends=======================================

Stability in State Space:


As we know that the values of the system’s poles are equal to the Eigen values of the system
matrix A. The Eigen values of matrix A is the solution of det(SI-A)=0. If real part of any
Eigen value is positive then the system will be unstable.
Consider the following state and output equations

Example 5: Write a Matlab Code to find the stability of the following system.
0 3 1 10
𝑥̇ = [ 2 8 1 ] 𝑥 + [ 0 ]𝑢
−10 −5 −2 0
𝑦 = [1 0 0]
0 3 1 10
Where 𝐴 = [ 2 8 1 ] and 𝑏 = [ 0 ]
−10 −5 −2 0
𝑐 = [1 0 0] and 𝑑 = [0]

Control Systems Lab (EE 360 L) Page 8


Lab08: Stability Analysis using MATLAB

MATLAB Code:
%==========================================================================
% State Space Stability Criterion
%+++++++++++++++++++++++++++++++++++++++++++++++++
% May.16.2012, +
% Engr. Hassaan Haider +
% hassaan.haider@iiu.edu.pk +
% Dept of Electronic Engineering +
% Faculty of Engineering and Technology +
% International Islamic University, Islamabad +
%+++++++++++++++++++++++++++++++++++++++++++++++++

clc; clear all;


disp(' ')
A=input('Input the System Matrix A,i.e:[a11 a12; a21 a22]= ');
[rows,cols]=size(A);

disp(' ')
disp('----------------------------------------')
disp('Eigen Values (Poles) of the System Matrix are: '),
eigVal=eig(A);
disp(eigVal);

% Checking for Signs


temp=0;
for j=1:rows,
if(real(eigVal(j))<0);
temp=temp+1;
end
end
if temp==rows
disp(' ----> System is Stable <----')
else
disp(' ----> System is Unstable <----')
end

%=======================Program Ends=======================================

Control Systems Lab (EE 360 L) Page 9


Lab08: Stability Analysis using MATLAB

Exercises

Exercise 1: Write a Matlab Code to generate the Routh Table. Also state whether the system
is stable or unstable and number of poles on R.H.S. of the S-Plane.
𝐶(𝑠) 100
= 4
𝑅(𝑠) 𝑠 + 3𝑠 3 + 2𝑠 + 3

Exercise 2: Make a Routh table and tell how many roots of the following characteristic
polynomial are in the right half-plane and in the left half-plane.
P( s)  3s 7  9s 6  6s 5  4s 4  7 s 3  8s 2  2s  6

Exercise 3: Derive the state space and output equation for the series RLC Circuit. Take any
values of R, L and C. Take 𝑣𝑖 as input and 𝑣𝑐 as output. Determine whether the system is
stable or not?

Control Systems Lab (EE 360 L) Page 10

You might also like