You are on page 1of 62

# Assignment

## Submitted to sir Umer Rana

Submitted by Mariyam Zafar

Roll no 916

B.E 6

## Lahore College for Women University

Lahore
Experiment :

Objective:
To evalute the effect of pole and zero location upon the time response of first and second
order system.

Pre lab:
1.Given the transfer function G(s)= a/ (s+a). Evalute settling time and rise time for the
following values of a=1,2,3,4.plot the poles

Solution:

For a=1

## In the command window

>>a=1

a=

>> numf=[a]

numf =

>> denf=[1 a]

denf =

1 1

>> t=tf([numf],[denf])

Transfer function:
1
-----
s+1

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on the scope we get
In the command window, write
>>p=pole(t)
p=

-1
>>z=zero(t)
z=

## Empty matrix: 0-by-1

>>y=pzmap(t)
y=

-1

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time and settling time.
For a =2

## In the command window

>>a=2

a=

>> num=[a]

num =

2
>> den=[1 a]

den =

1 2

>> t=tf([num],[den])

Transfer function:
2
-----
s+2

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this.
By clicking on scope we get.

>> p=pole(t)

p=

-2

>> z=zero(t)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t)

y=

-2

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time and settling time
For a=3

## In the command window ,write

>>a=3

a=

>> num=[a]

numf =

3
>> den=[1 a]

den =

1 3

>> t=tf([num],[den])

Transfer function:
3
-----
s+3

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this.
By clicking on scope we get

p =pole(t)
p=

-3

>> z=zero(t)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t)

y=

-3

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time and settling time
For a=4

## In the command window

>>a=4

a=

>> num=[a]

num=

4
>> den=[1 a]

den =

1 4

>> t=tf([num],[den])

Transfer function:
4
-----
s+4

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this

## By clicking on scope we get

In the command window

>> p=pole(t)

p=

-4

>> z=zero(t)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t)

y=

-4
Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time and settling time
For 2nd order system

## 2. Given the transfer function G(s)=b/(s*2+as+b)

a) evaluate percent overshoot, settling time, peak time, and rise time for the
following values, a=4, b= 25. Also plot the poles.

Solution:

## In the command window

>>a=4

a=

>> b=25

b=

25

>> num=[b]

num=

25

>> den=[1 a b]

den =

1 4 25

>> t1=tf([num],[den])

Transfer function:

25
--------------

s^2 + 4 s + 25
then draw the diagram in the simulink.
Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get

## In the command window, write

>> p=pole(t1)

p=

-2.0000 + 4.5826i
-2.0000 - 4.5826i

>> z=zero(t1)

z=

## >> y=pzmap (t1)

y=

-2.0000 + 4.5826i
-2.0000 - 4.5826i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, peak time rise time and settling time,peak time and
overshoot
b) Calculate the values of a and b so that imaginary part of the poles remains the
same but the real part is increased 2 times over that of (a) and repeat prelab(2a).

Solution:

## In the command window

>>a=8

a=

8
>> b=37
b=

37

>> num=[b]

numf=

37
>> den=[1 a b]

den =

1 8 37

>> t1=tf([num],[den])

Transfer function:

37
--------------

s^2 + 8s + 37

## Then draw the diagram in the simulink.

Write simulink in the command window. Then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get
In the command window

>> p=pole(t1)
p=

-4.0000 + 4.5826i
-4.0000 - 4.5826i
>> z=zero(t1)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t1)

y=

-4.0000 + 4.5826i
-4.0000 - 4.5826i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole,peak time,overshoot, rise time and settling time
c) Calculate the values of a and b so that the imaginary part of the poles are remain
the same but the real part is decreased1/2 time over of (a) and repeat prelab(2a).

Solution:

a=2, b=22

## In the command window

>>a=2
a=

2
>> b=22
b=

22

>> num=[b]

num ==

22
>> den=[1 a b]

den =

1 2

>> t1=tf([num],[den])

Transfer function:

22
--------------

s^2 + 2s + 22

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get
In the command window

>> p=pole(t1)

p=

-1.0000 + 4.5826i
-1.0000 - 4.5826i

>> z=zero(t1)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t1)

y=

-1.0000 + 4.5826i
-1.0000 - 4.5826i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, peak time,overshoot, rise time and settling time
3.
a) For the system of prelab 2(a) calculate the values of a and b so that the real
part of the poles remains the same but the imaginary part is increased 2
times ove that of prelab 2(a) and repeat prelab 2(a)
b)
Solution :

## Now the values of a and b are.

A=4, b=88
In the command window w

>>a=4
a=

>> b=88

b=

88

>> num=[b]

num =

88

>> den=[1 a b]

den =

1 4 88

>> t1=tf([num],[den])

Transfer function:

88
--------------

s^2 + 4s + 88

## Then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get
In the command window
>> p=pole(t1)

p=

-2.0000 + 9.1652i
-2.0000 - 9.1652i

z=zero(t1)
z=

## Empty matrix: 0-by-1

>> y=pzmap(t1)

y=

-2.0000 + 9.1652i
-2.0000 - 9.1652i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, peak time,overshoot ,rise time and settling time
b) For the system of prelab 2(a) calculate the values of a and b so that the real
part of the poles remains the same but the imaginary part is increased 4
times over that of prelab 2(a) and repeat prelab 2(a).
Solution :

A= 4, b=340

## In the command window

>>a=4
a=

>> b=340
b=

340

>> num=[b]

num=

340

>> den=[1 a b]

den =

1 4 340

>> t1=tf([num],[den])

Transfer function:

340
--------------

s^2 + 4s + 340

## then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get
In the command window

>> p=pole(t1)

p=

-2.0000 +18.3303i
-2.0000 -18.3303i
>> z=zero(t1)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t1)

y=

-2.0000 +18.3303i
-2.0000 -18.3303i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time peak time,overshoot and settling time
4
a) For the system of prelab 2(A) calculate the values of a and b so that tha
damping ratio remains the same but the natural frequency is increased 2
times over of prelab 2(a) and repeat prelab 2(a).

Solution :

## Now the values of a and b are

A= 4,b=25
In the command window
>> a=4

a=

>> b=25

b=

25

>> omega=sqrt(b)

omega =

>> eeta=(a/(2*omega))

eeta =

0.4000

>> omega=10

omega =

10

>> eeta=0.4

eeta =

0.4000

>> b=omega*omega

b=

100

>> a=2*eeta*omega
a=

>> num=[b]

num =

100

>> den=[1 a b]

denf=

1 8 100

>> t=tf([num],[den])

Transfer function:
100
---------------
s^2 + 8 s + 100

## then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get
In the command window write

p=pole(t)

p=

-4.0000 + 9.1652i
-4.0000 - 9.1652i

>> z=zero(t)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t)

y=

-4.0000 + 9.1652i
-4.0000 - 9.1652i

Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time, peak time,overshoot and settling time
b) For the system pf prelab 2 (a) calculate the values of a and b so that the
damping ratio remains the same but the natural frequency is increases 4
times over that of prelab 2(a) and repeat prelab 2(a).

Solution :

## In the command window

>> eeta=0.4

eeta =

0.4000

>> omega=20
omega=

20

>> b=omega*omega

b=

400

>> a=2*eeta*omega

a=

16

>> num=[b]

num=

400

>> den=[ 1 a b]

den =

1 16 400

>> t=tf([num],[den])

Transfer function:
400
----------------
s^2 + 16 s + 400

## then draw the diagram in the simulink.

Write simulink in the command window. then draw the block diagram of the transfer
function. It will be like this
By clicking on scope we get

## In the command window

>> p=pole(t)

p=

-8.0000 +18.3303i
-8.0000 -18.3303i

>> z=zero(t)

z=

## Empty matrix: 0-by-1

>> y=pzmap(t)

y=

-8.0000 +18.3303i
-8.0000 -18.3303i
Write ltiview in command window then import the above transfer function (G) the graph
will be like this with its pole, rise time and settling time,peak time and overshoot.
LAB
1) Using simulink set up the system of prelab 1 and plot the step response of
each of four transfer functions on a single graph by using the simulink LTI
viwer. Also record the values of settling time and rise time for each step
response.

Solution

## Use the following command in command window

>> a1=tf(,[1 1])

Transfer function:
1
-----
s+1

## >> a2=tf(,[1 2])

Transfer function:
2
-----
s+2

## >> a3=tf(,[1 3])

Transfer function:
3
-----
s+3

## >> a4=tf(,[1 4])

Transfer function:
4
-----

s+4

>> step(a1,a2,a3,a4)

Now for LTI VIEWER (for rise time and settling time)

>> ltiview
Import the transfer functions one by one on tha single graph.
Settling time for a1=3.91
and rise time for a1=2.2.

## Settling time for a2=1.96

and rise time for a2=1.1

## Settling time for a3=1.3

and rise time for a3=0.732

## Settling time for a4=0.978

and rise time for a4=0.549
1) Using simulink set up the system of prlab 2using the simulink LTI VIEWER
plot the step response of each of the 3 transfer functions on a single graph .
tlso record the values of percentage overshoot,setlling time,peak time and
rise time of each step response

## >> b1=tf(,[1 4 25])

Transfer function:
25
--------------
s^2 + 4 s + 25

## >> b2=tf(,[1 8 37])

Transfer function:
37
--------------
s^2 + 8 s + 37

## >> b3=tf(,[1 2 22])

Transfer function:
22
--------------
s^2 + 2 s + 22

>> step(g,g1,g2)
>> ltiview
B1
Percent overshoot =25.4
Settling time =1.3
Rise time =0.732

B2
Percent overshoot=6.44
Settling time=0.988
Rise time=o.329

B3
Percent overshoot=50.4
Settling time=3.64
Rise time=0.261
1) Using simulink , set up the system of prelab 2 a)and prelab 3. Using the
simulink LTI viewer plot the step response of each of the 3 transfer functions
on a single graph . also record the values of percent overshoot , settling
time,peak time and rise time for each step response.

Solution:
Use the following commands in command window

## >> c1=tf(,[1 4 25])

Transfer function:
25
--------------
s^2 + 4 s + 25

## >> c2=tf(,[1 4 88])

Transfer function:
88
--------------
s^2 + 4 s + 88

## >> c3=tf(,[1 4 340])

Transfer function:
340
---------------
s^2 + 4 s + 340

>> step(f,f1,f2)

>> ltiview
for c1:
Percent overshoot=25.4
Settling time=1.3
Rise time=0.732

For c2:
Percent overshoot=50.4
Settling time=1.82
Rise time=0.131

For c3:
Percent overshoot=70.9
Settling time=1.91
Rise time=0.0607
4) simulink set up the system of prelab 2 a) and prelab 4 using the simulink
LTI viewer , plot the step response of ech of the three transfer functions
on a sigle graph. Also record the values of percent overshoot, settling
time, peaktime and a rise timr for each response

Solution:

## >> d1=tf(,[1 4 25])

Transfer function:
25
--------------
s^2 + 4 s + 25

## >> d2=tf(,[1 8 100])

Transfer function:
100
---------------
s^2 + 8 s + 100

## >> d3=tf(,[1 16 400])

Transfer function:
400
----------------
s^2 + 16 s + 400

>> step(r,r1,r2)
>> ltiview

## >> r=tf(,[1 4 25])

Transfer function:
25
--------------
s^2 + 4 s + 25

## >> r1=tf(,[1 8 100])

Transfer function:
100
---------------
s^2 + 8 s + 100
>> r2=tf(,[1 16 400])

Transfer function:
400
----------------
s^2 + 16 s + 400

## In order to draw the three step responses on a single graph

>> step(r,r1,r2)

Now for LTI VIEWER (for rise time and settling time,over shoot and peak time)

>> ltiview

## Import the transfer functions one by one on tha single graph

for d1:
Percent overshoot=25.4
Settling time=1.3
Rise time=0.732

For d2:
Percent overshoot=25.4
Settling time=0.147
Rise time=0.841

For d3:
Percent overshoot=25.4
Settling time=0.42
Rise time=0.0734