Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

Practical: 1 unit impulse response

num = [0 0 1];
den = [1 0.2 1];
impulse(num,den);
grid
title('Unit-Impulse Response of G(s) = l/(s^2 + 0.2s + 1)')

Output
Unit-Impulse Response of G(s) = l/(sA2 + 0.2s + 1)

1
0.8
0.6

Amplitude

0.4
0.2
0
-0.2
-0.4
-0.6
-0.8

10

20

30

40

Time (sec)

Practical: 2 Unit ramp response

50

60

num = [0 0 0 1];
den = [1 1 1 0];
t=0:0.2:7;
dhruvi=step(num,den,t);
plot(t,dhruvi,'*',t,dhruvi,'--')
grid
title('unit ramp response curve for system')
xlabel('t sec')
ylabel('input and output')

Output

unit ramp response curve for system

7
6

input and output

5
4
3
2
1
0
0

t sec

Practical: 3 Step response

A = [-1 -1;6.5 0];


B = [1 1;1 0];
C = [1 0;0 1];
D = [0 0;0 0];
step(A,B,C,D)

Output
Step Response
From: In(1)

0.4

From: In(2)

To: Out(1)

0.2
0

Amplitude

-0.2
-0.4
2

To: Out(2)

1.5
1
0.5
0

10

12 0
Time (sec)

10

12

Practical: 4 root locus plot

num =[0 1 3 0 1];


den = [1 1.1 10.3 5 0];
sys=tf(num,den);
rlocus(num,den);
title('Root-Locus Plot')
xlabel('Rea1 Axis');
ylabel('lmag Axis');

Output
Root-Locus Plot

5
4
3
2

lmag Axis

1
0
-1
-2
-3
-4
-5
-14

-12

-10

-8

-6
Rea1 Axis

-4

-2

(2)

Root locus

num =[4 1 3 8 1];


den = [1 6 10 5 0];
sys=tf(num,den);
rlocus(num,den);
title('Root-Locus Plot')
xlabel('Rea1 Axis');
ylabel('lmag Axis');

Output
Root-Locus Plot

2
1.5
1

lmag Axis

0.5
0
-0.5
-1
-1.5
-2
-4

-3.5

-3

-2.5

-2

-1.5
Rea1 Axis

-1

-0.5

0.5

Practical: 5 bode plot

num = [0 0 25];
den = [1 4 25];
bode(num,den)
title('Bode Diagram of G(s) = 25/(sA2 + 4s + 25)')

Output

Bode Diagram of G(s) = 25/(sA2 + 4s + 25)

Magnitude (dB)

20
0
-20
-40

Phase (deg)

-60
0
-45
-90
-135
-180

-1

10

10

10
Frequency (rad/sec)

10

(2) Bode plot

num = [0 9 1.8 9];


den = [1 1.2 9 0];
bode(num,den)
title('Bode Diagram of G(s) = 9(sA2 + 0.2s + 1)/[s(s^2 + 1.2s + 911')

Output

Bode Diagram of G(s) = 9(sA2 + 0.2s + 1 )/[s(sA2 + 1.2s + 911

20

Magnitude (dB)

10
0
-10
-20

Phase (deg)

-30
90
45
0
-45
-90

-1

10

10

10
Frequency (rad/sec)

10

(3)

Bode plot

a=[0 1;-25 4];


b=[0;25];
c=[1 0];
d=[0];
bode(a,b,c,d)
title('Bode Diagram')

Output
Bode Diagram

Magnitude (dB)

20
0
-20
-40

Phase (deg)

-60
-180
-225
-270
-315
-360

-1

10

10

10
Frequency (rad/sec)

10

Practical: 6 nyquist plot

num = [0 0 1];
den = [1 0.8 1];
nyquist(num,den)
grid
title('Nyquist Plot of G(s) = l/(s^2 + 0.8s + 1)')

Output
1.5

Nyquist Plot of G(s) = l/(s 2 + 0.8s + 1 )


2 dB

0 dB

-2 dB
-4 dB

4 dB
-6 dB

6 dB
Imaginary Axis

0.5

-10 dB

10 dB
20 dB

-20 dB

-0.5

-1

-1.5
-1

-0.5

0.5
Real Axis

1.5

(2) Nyquist plot


num = [0 0 1];
den = [1 1 0];
nyquist(num,den)
grid
title('Nyquist Plot of G(s) = l/[s(s + 111)]')

Output
Nyquist Plot of G(s) = l/[s(s + 111)]

20

0 dB

15

Imaginary Axis

10
5
0

2
dB
4
6 dB

-2
dB
-4
-6 dB

-5
-10
-15
-20
-1

-0.9

-0.8

-0.7

-0.6

-0.5
Real Axis

(3) Nyquist plot

-0.4

-0.3

-0.2

-0.1

A = [-1 -1;6.5 0];


B = [1 1;1 0];
C= [1 0;0 1];
D = [0 0;0 0];
nyquist(A,B,C,D)

Output
Nyquist Diagram
From: In(1)

From: In(2)

To: Out(1)

0.5
0

Imaginary Axis

-0.5
-1
3

To: Out(2)

2
1
0
-1
-2
-3
-1

3 -2
Real Axis

-1

Practical: 7 Transfer function to state space


num=[10 2 5 6];
den=[4 6 5 14];
sys=tf(num,den);
[a,b,c,d]=tf2ss(num,den)

Output
a=
-1.5000

-1.2500

1.0000

0
b=
1
0
0
c=
-3.2500
-1.8750
-7.2500
d=
2.5000

1.0000

-3.5000
0
0

(2) Transfer function to state space


num=[1 25 4];
den=[3 2 4];
sys=tf(num,den)
[a,b,c,d]=tf2ss(num,den)

Output

a = -0.6667

-1.3333

1.0000
0
b =1
0
c = 8.1111
d =0.333

0.8889

Practical: 8 Residue
num = [5 1 2 3];
den= [1 3 3 1];
sys=tf(num,den)
[r,p,k] = residue(num,den)

Output
Transfer function:
5 s^3 + s^2 + 2 s + 3
--------------------S^3 + 3 s^2 + 3 s + 1

r=
-14
15
-3
p=
-1
-1
-1
k=
5

(2) Residue

num = [8 4 2 8 1 2];
den=[1 2 10 8 9 8];
[r,p,k] = residue(num,den)

Output
r=
-6.2539 +11.2652i
-6.2539 -11.2652i
0.1259 - 0.3533i
0.1259 + 0.3533i
0.2560
p=
-0.6439 + 2.7780i
-0.6439 - 2.7780i
0.0881 + 1.0487i
0.0881 - 1.0487i
-0.8883
k=
8

Practical: 9 Unit step response of 2 and 3


dimension
t = 0:0.2:20;
zeta = [0 0.2 0.4 0.6 0.8 1];
for n = 1:6;
num = [0 0 1];
den = [1 2*zeta(n) 1];
[y(1:101,n),x,t] = step(num,den,t);
end
% To plot a two-dimensional diagram, enter the command plot (t,y).
plot(t,y)
grid
title('Plot of Unit-Step Response Curves with \omega-n = 1 and \zeta = 0, 0.2, 0.4, 0.6, 0.8, 1
')
xlabel ('t (sec)')
ylabel('Response1')
text(4.1,1.86,'\zeta = 0')
text(3.5,1.5,'0.2')
text(3.5,1.24,'0.4')
text(3.5,1.08,'0.6')
text(3.5,0.95,'0.8')
text(3.5,0.86,'1')
% To plot a three-dimensional diagram, enter the command mesh(t,zeta,yl).
mesh(t,zeta,y')
title('Three-Dimensional Plot of Unit-Step Response Curves')
xlabel('t Sec')
ylabel('\zeta1')
zIabel('Response1')

Output

Plot of Unit-Step Response Curves with -n = 1 and = 0,0.2, 0.4, 0.6, 0.8, 1
2

= 0

1.8
1.6

0.2

Response1

1.4

0.4

1.2

0.6

0.8
1

0.8
0.6
0.4
0.2
0

10
t (sec)

12

14

16

18

20

Three-Dimensional Plot of Unit-Step Response Curves

Respons e1

1.5
1
0.5
0
1
0.5

10
t Sec

15

20

Practical: 10 transfer function


z=[-5;-9];
p=[0;-4;-6];
k=5;
[num,den]=zp2tf(z,p,k);
Printsys (num, den,'s')

Output
Num/den =
5 s^2 + 70 s + 225
------------------s^3 + 10 s^2 + 24 s

You might also like