You are on page 1of 9

International Islamic University, Islamabad

Faculty of Engineering and Technology


Department of Electronic Engineering

CONTROL SYSTEMS LAB

LAB EXPERIMENT # 10: Time Response Analysis of 1st Order and


2nd Order Systems using MATLAB
Name of Student:
Registration No.:
Section:
Date of Experiment:
Report submitted on:

Marks obtained:
Remarks:
Instructors Signature: ...

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Lab Experiment 10: Time Response Analysis of 1st Order and 2nd
Order Systems using MATLAB

Objective: The objective of this exercise will be to study the performance characteristics of
first and second order systems using MATLAB.
Overview First Order Systems:
An electrical RC-circuit is the simplest example of a first order system. It comprises of a
resistor and capacitor connected in series to a voltage supply as shown below on Figure 1.

Figure 1: RC Circuit
If the capacitor is initially uncharged at zero voltage when the circuit is switched on, it
starts to charge due to the current i' through the resistor until the voltage across it reaches the
supply voltage. As soon as this happens, the current stops flowing or decays to zero, and the
circuit becomes like an open circuit. However, if the supply voltage is removed, and the
circuit is closed, the capacitor will discharge the energy it stored again through the resistor.
The time it takes the capacitor to charge depends on the time constant of the system, which is
defined as the time taken by the voltage across the capacitor to rise to approximately 63% of
the supply voltage. For a given RC-circuit, this time constant is = . Hence its magnitude
depends on the values of the circuit components.
The RC circuit will always behave in this way, no matter what the values of the
components. That is, the voltage across the capacitor will never increase indefinitely. In this
respect we will say that the system is passive and because of this property it is stable.
For the RC-circuit as shown in Fig. 1, the equation governing its behavior is given by using
KVL:
() + () = ()
() + () = ()
()

() + () = ()

()
()
()
+ =
where (0) = 0
(1)

where () is the voltage across the capacitor, R is the resistance and C is the capacitance.
The constant = is the time constant of the system and is defined as the time required by
the system output i.e. () to rise to 63% of its final value (which is E). Hence the above
equation (1) can be expressed in terms of the time constant as:
()
+ () = where (0) = 0
(2)

Obtaining the transfer function of the above differential equation, we get


()
1
=
(3)
()

+1

where is time constant of the system and the system is known as the first order system. The
performance measures of a first order system are its time constant and its steady state.
Control Systems Lab (EE 360 L)

Page 41

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Exercise 1:
a) Given the values of R and C, obtain the unit step response of the first order system.
i.
R=2K and C=0.01F
ii. R=2.5K and C=0.003F
b) Verify in each case that the calculated time constant ( = ) and the one measured
from the figure as 63% of the final value are same.
c) Obtain the steady state value of the system.
Overview Second Order Systems:
Consider the following Mass-Spring system shown in the Figure 2. Where K is the spring
constant, B is the friction coefficient, () is the displacement and () is the applied force:

Figure 2: Mass-Spring System


The differential equation for the above Mass-Spring system can be derived as follows
2 ()
()

+ () = ()
2

Applying the Laplace transformation we get


( 2 + + ) () = ()

provided that, all the initial conditions are zeros. Then the transfer function representation of
the system is given by
()
1
=
=
=

() ( 2 + + )
The above system is known as a second order system.

The generalized notation for a second order system described above can be written as
() =

2
()
2 + 2 + 2

With the step input applied to the system, we obtain


() =

2
( 2 + 2 + 2 )

for which the transient output, as obtained from the Laplace transform is

Control Systems Lab (EE 360 L)

Page 42

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB
() = 1

1 2

sin ( 1 2 + 1 ())

where 0 < < 1. The transient response of the system changes for different values of
damping ratio, . Standard performance measures for a second order feedback system are
defined in terms
of step response of a system. Where, the response of the second order system is shown below.

The performance measures could be described as follows:


Rise Time: The time for a system to respond to a step input and attains a response equal to a
percentage of the magnitude of the input. The 0-100% rise time, Tr, measures the time to
100% of the magnitude of the input. Alternatively, Tr1, measures the time from 10% to 90%
of the response to the step input.
Peak Time: The time for a system to respond to a step input and rise to peak response.
Overshoot: The amount by which the system output response proceeds beyond the desired
response. It is calculated as

. . =
100%

where is the peak value of the time response, and fv is the final value of the response.
Settling Time: The time required for the systems output to settle within a certain percentage
of the input amplitude (which is usually taken as 2%). Then, settling time, Ts, is calculated as
=

Control Systems Lab (EE 360 L)

Page 43

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB
Example 1:

The generalized equation for 2nd order system can be written as

Solution:

Write a Matlab Code to find the , , & of a second order system,


when = 7 and = 0.4.

()
2
= 2
() + 2 + 2

>> num =
[0
0
49];
>> den =
[1
5.6
49];
>> t = 0: 0.005: 5;
>> [y, x, t] = step (num, den, t);
>> %Rise Time
>> r = 1; while y(r) < 1.0001; r = r + 1; end
>> rise_time = (r 1) * 0.005;
>> %Peak Time
>> [ ymax, tp ] = max(y);
>> peak_time = (tp 1) * 0.005;
>> % Maximum Overshoot
>> max_overshoot = ymax 1;
>> % max_overshoot = 0.0948
>> % Settling Time
>> s = 1001; while y(s) > 0.98 & y(s) < 1.02; s = s -1; end
>> settling_time = (s 1) * 0.005;

Under-damped Second-Order System Response:

Control Systems Lab (EE 360 L)

Page 44

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Step responses of second-order under-damped systems as poles move with constant real
part:
clc; clear all; close all;
z=0; k=100;
p=[-0.3+1j,-0.3-1j];
sys1=zpk(z,p,k);
p=[-0.3+1.5j,-0.3-1.5j];
sys2=zpk(z,p,k);
p=[-0.3+2j,-0.3-2j];
sys3=zpk(z,p,k);
step(sys1,sys2,sys3)
legend('Poles at -0.3+j &-0.3-j',...
'Poles at -0.3+1.5j &-0.3-1.5j',...
'Poles at -0.3+2j &-0.3-2j')

Step Response
70
Poles at -0.3+j &-0.3-j
60

Poles at -0.3+1.5j &-0.3-1.5j


Poles at -0.3+2j &-0.3-2j

50
40

Amplitude

30
20
10
0
-10
-20
-30

10

12

14

16

18

20

Time (seconds)

When poles move in vertical direction, keeping the real part same, frequency increases but
the envelope remains the same. Since all curves fit under the same exponential decay curve,
the settling time is virtually the same for all waveforms. Also note that as overshoot
increases, the rise time decreases.

Control Systems Lab (EE 360 L)

Page 45

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Step responses of second-order under-damped as poles move with constant imaginary


part:

clc; clear all; close all;


z=0; k=100;
p=[-1+2j,-1-2j];
sys1=zpk(z,p,k);
p=[-2+2j,-2-2j];
sys2=zpk(z,p,k);
step(sys1,sys2)
legend('Poles at -1+j &-1-j',...
'Poles at -1+1.5j &-1-1.5j')

Step Response
30
Poles at -1+j &-1-j
Poles at -1+1.5j &-1-1.5j

25

20

Amplitude

15

10

-5

-10

Time (seconds)

Here poles move from right to left, since the imaginary part is now constant. So frequency
remains constant over the range of variations of the real part. As the poles move to the left,
the response damps out more rapidly. Notice that, peak time remains same because of
constant imaginary time.

Control Systems Lab (EE 360 L)

Page 46

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Step responses of second-order under-damped as poles move with constant damping


ratio:
clc; clear all; close all;
s=tf('s');
zeta=0.4;
wn=5;
sys1=wn^2/(s^2+2*zeta*wn*s+wn^2);
wn=6;
sys2=wn^2/(s^2+2*zeta*wn*s+wn^2);
wn=7;
sys3=wn^2/(s^2+2*zeta*wn*s+wn^2);
pole(sys1),pole(sys2),pole(sys3)
step(sys1,sys2,sys3)
legend('Sys1','Sys2','Sys3')
Step Response
1.4
Sys1
Sys2
1.2

Sys3

Amplitude

0.8

0.6

0.4

0.2

0.5

1.5

2.5

Time (seconds)

Moving the poles along the constant damping ratio, the percentage overshoot remains the
same. Note that responses look exactly alike, except for their speed. The farther the poses are
from the origin, the more rapid the response.

Control Systems Lab (EE 360 L)

Page 47

Lab10: Time Response Analysis of 1st and 2nd Order Systems using MATLAB

Exercise 2: Effect of damping ratio on performance measures. For a single-loop second


order feedback system given below

a) Find the step response of the system for values of n = 1 and = 0.1, 0.4, 0.7, 1.0
and 2.0. Plot all the results in the same figure window and fill the following table.

Rise time

Peak Time

% Overshoot

Settling time

Steady state value

0.1
0.4
0.7
1.0
2.0
b) Write a Matlab Code to find the , , & of a second order system, when
= 5 and = 0.7.

Control Systems Lab (EE 360 L)

Page 48

You might also like