lab assignment

68
Assignment Submitted to sir Umer Rana Submitted by Mariyam Zafar Roll no 916 B.E 6 Lahore College for Women University Lahore

Upload: emma-amir

Post on 27-Nov-2014

592 views

Category:

Documents


18 download

TRANSCRIPT

Page 1: Lab Assignment

Assignment

Submitted to sir Umer RanaSubmitted by Mariyam Zafar

Roll no 916

B.E 6

Lahore College for Women University Lahore

Page 2: Lab Assignment

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 =

1

>> numf=[a]

numf =

1

>> 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

Page 3: Lab Assignment

By clicking on the scope we get

Page 4: Lab Assignment

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.

Page 5: Lab Assignment

For a =2

In the command window

>>a=2

a =

2

>> num=[a]

num =

2

Page 6: Lab Assignment

>> 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.

Page 7: Lab Assignment

By clicking on scope we get.

In the command window, write

>> 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

Page 8: Lab Assignment
Page 9: Lab Assignment

For a=3

In the command window ,write

>>a=3

a =

3

>> num=[a]

numf =

3

Page 10: Lab Assignment

>> 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.

Page 11: Lab Assignment

By clicking on scope we get

In the command window write

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

Page 12: Lab Assignment
Page 13: Lab Assignment

For a=4

In the command window

>>a=4

a =

4

>> num=[a]

num=

4

Page 14: Lab Assignment

>> 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

Page 15: Lab Assignment

In the command window

>> p=pole(t)

p =

-4

>> z=zero(t)

z =

Empty matrix: 0-by-1

>> y=pzmap(t)

y =

-4

Page 16: Lab Assignment

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

Page 17: Lab Assignment
Page 18: Lab Assignment

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 =

4

>> 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

Page 19: Lab Assignment

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

Page 20: Lab Assignment

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 =

Empty matrix: 0-by-1

>> y=pzmap (t1)

Page 21: Lab Assignment

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

Page 22: Lab Assignment

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). Now put the value of a=8, b=37

Solution:

In the command window

>>a=8

a =

8

Page 23: Lab Assignment

>> b=37b =

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

Page 24: Lab Assignment

By clicking on scope we get

Page 25: Lab Assignment

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

Page 26: Lab Assignment
Page 27: Lab Assignment

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: now the values of a and b are a=2, b=22

In the command window

>>a=2a =

2

Page 28: Lab Assignment

>> b=22b =

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

Page 29: Lab Assignment

By clicking on scope we get

Page 30: Lab Assignment

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

Page 31: Lab Assignment
Page 32: Lab Assignment

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

Page 33: Lab Assignment

In the command window w

>>a=4a =

4

>> 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

Page 34: Lab Assignment

By clicking on scope we get

Page 35: Lab Assignment

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

Page 36: Lab Assignment
Page 37: Lab Assignment

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 :

Now the values of a and b are A= 4, b=340

In the command window

>>a=4a =

4

>> b=340

Page 38: Lab Assignment

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

Page 39: Lab Assignment

By clicking on scope we get

Page 40: Lab Assignment

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

Page 41: Lab Assignment

4a) 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

Page 42: Lab Assignment

In the command window >> a=4

a =

4

>> b=25

b =

25

>> omega=sqrt(b)

omega =

5

>> 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

Page 43: Lab Assignment

a =

8

>> 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

Page 44: Lab Assignment

By clicking on scope we get

Page 45: Lab Assignment

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

Page 46: Lab Assignment
Page 47: Lab Assignment

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

Page 48: Lab Assignment

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

Page 49: Lab Assignment
Page 50: Lab Assignment

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

Page 51: Lab Assignment

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.

Page 52: Lab Assignment

LAB1) 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 1]) Transfer function: 1-----s + 1

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

Page 53: Lab Assignment

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

>> a3=tf([3],[1 3]) Transfer function: 3-----s + 3 >> a4=tf([4],[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.

Page 54: Lab Assignment

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.3and rise time for a3=0.732

Settling time for a4=0.978and rise time for a4=0.549

Page 55: Lab Assignment

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

Use the following command in command window

>> b1=tf([25],[1 4 25]) Transfer function: 25--------------s^2 + 4 s + 25 >> b2=tf([37],[1 8 37]) Transfer function: 37--------------s^2 + 8 s + 37

>> b3=tf([22],[1 2 22]) Transfer function: 22--------------s^2 + 2 s + 22

>> step(g,g1,g2)

Page 56: Lab Assignment

>> ltiview

Page 57: Lab Assignment

B1Percent overshoot =25.4Settling time =1.3Rise time =0.732

B2Percent overshoot=6.44Settling time=0.988Rise time=o.329

B3Percent overshoot=50.4Settling time=3.64Rise time=0.261

Page 58: Lab Assignment

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([25],[1 4 25]) Transfer function: 25--------------s^2 + 4 s + 25 >> c2=tf([88],[1 4 88]) Transfer function: 88--------------s^2 + 4 s + 88 >> c3=tf([340],[1 4 340]) Transfer function: 340---------------s^2 + 4 s + 340 >> step(f,f1,f2)

>> ltiview

Page 59: Lab Assignment

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

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

For c3:Percent overshoot=70.9Settling time=1.91Rise time=0.0607

Page 60: Lab Assignment

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:

Used the following commands in command window

>> d1=tf([25],[1 4 25]) Transfer function: 25--------------s^2 + 4 s + 25 >> d2=tf([100],[1 8 100]) Transfer function: 100---------------s^2 + 8 s + 100

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

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

>> r=tf([25],[1 4 25]) Transfer function: 25--------------s^2 + 4 s + 25 >> r1=tf([100],[1 8 100]) Transfer function: 100---------------s^2 + 8 s + 100

Page 61: Lab Assignment

>> r2=tf([400],[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

Page 62: Lab Assignment

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

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

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