0% found this document useful (0 votes)
84 views85 pages

CT Shail PDF

The document contains 3 problems related to transfer function analysis in MATLAB: 1) It defines a 4th order transfer function and obtains its poles, zeros, partial fraction expansion, and plots the impulse response. 2) It defines a 3rd order transfer function, obtains its poles, zeros, partial fraction expansion, and plots the step response and determines the system DC gain. 3) It defines a 5th order transfer function and plots the zero state response to a piecewise input signal.

Uploaded by

hoca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views85 pages

CT Shail PDF

The document contains 3 problems related to transfer function analysis in MATLAB: 1) It defines a 4th order transfer function and obtains its poles, zeros, partial fraction expansion, and plots the impulse response. 2) It defines a 3rd order transfer function, obtains its poles, zeros, partial fraction expansion, and plots the step response and determines the system DC gain. 3) It defines a 5th order transfer function and plots the zero state response to a piecewise input signal.

Uploaded by

hoca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

PRACTICAL - 1

AIM: - To Study Programs related to


transfer function, partial fraction
expansion and roots

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [1]
AIM: - To Study Programs related to transfer function,
partial fraction expansion and roots

 Problem – 1:

Create a transfer function object for the fourth order differential equation
is as mentioned below. Then display the object properties and extract the
numerator and denominator polynomials from the transfer function object
and display them as row vectors. Draw a pole zero plot.

G(s) = Y(s)
X(s)
Differential : d2y + 5dy + 4y = d4x + 12dx3 + 69dx2 + 198dx + 201x
Equation dt2 dt dt4 dt3 dt2 dt

 Program :

num=[1 5 4]; % Defining numerator term


den=[1 12 69 198 201]; % Defining denominator term
sys=tf(num,den) % Defining transfer function
get(sys) % Get object properties
pzmap(sys) % Pole-zero map of LTI models
[num,den] = tfdata(sys,'v') % Quick access to transfer function data
&
returns numerator, denominator &
sample time (Ts).

 Output :

Transfer function:
s^2 + 5 s + 4
-----------------------------------
s^4 + 12 s^3 + 69 s^2 + 198 s + 201

num: {[0 0 1 5 4]}


den: {[1 12 69 198 201]}
ioDelay: 0
Variable: 's'
Ts: 0
InputDelay: 0
OutputDelay: 0
InputName: {' '}
OutputName: {' '}
InputGroup: [1x1 struct]
OutputGroup: [1x1 struct]

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [2]
Name: ' '
Notes: {}
UserData: []

num =
0 0 1 5 4

den =
1 12 69 198 201

Pole-Zero Map
4

1
Imaginary Axis

-1

-2

-3

-4
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis

 Problem - 2 :

For the system given in problem-1 obtain the model of G(s) as ZPK
object then extract its zeros poles gain and show that they are same as
obtained in if object.

 Program :

num=[1 5 4];
den=[1 12 69 198 201];
sys = tf(num,den)
H=zpk(sys) % Create (or convert to) zero-pole-gain format
[z p k]=zpkdata(sys,'v') % Quick access to zero-pole-gain data & returns
the
[z p k]=zpkdata(H,'v') zeros, poles & gain for the LTI model sys

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [3]
 Output :

Transfer function:
s^2 + 5 s + 4
-----------------------------------
s^4 + 12 s^3 + 69 s^2 + 198 s + 201

Zero/pole/gain:
(s+4) (s+1)
------------------------------------
(s+3.97) (s+2.03) (s^2 + 6s + 24.94)

z=
-4
-1

p=
-3.0000 + 3.9926i
-3.0000 - 3.9926i
-3.9700
-2.0300

k=
1

z=
-4
-1

p=
-3.0000 + 3.9926i
-3.0000 - 3.9926i
-3.9700
-2.0300

k=
1

 Problem – 3:

Write a problem for obtaining partial fraction expansion of system sys(s).


Also obtain roots of numerator.

 Program :

num=[1 5 4];
den=[1 12 69 198 201];
sys = tf(num,den)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [4]
[r,p,k]=residue(num,den) % Partial-fraction expansion. Finds the residues,
poles and direct term of a partial fraction
expansion
r=roots(num) % Computes the roots of the polynomial

 Output :

Transfer function:
s^2 + 5 s + 4
-----------------------------------
s^4 + 12 s^3 + 69 s^2 + 198 s + 201

r=
0.0296 - 0.1331i
0.0296 + 0.1331i
0.0027
-0.0620

p=

-3.0000 + 3.9926i
-3.0000 - 3.9926i
-3.9700
-2.0300

k=
[]

r=
-4
-1

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [5]
PRACTICAL - 2
AIM: - To Study Programs for
transient response analysis.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [6]
AIM: - To Study Programs for transient response
analysis.

 Problem – 1:

The T.F. of a fixed linear system is

G(s) = 2(2s +7) + 3 = (3s3 + 24s2 + 55s + 44)


( s3 + 8s2 + 17s +10) (s3 + 8s2 + 17s +10)

Create the transfer function in matlab and determine its poles and zeros,
perform partial fraction expansion of G(s) & plot the impulse response of
the system.

 Program :

num=[3 24 53 33]
den=[1 8 17 10]
sys=tf(num,den)
SYS=zpk(sys)
[z p k]=zpkdata(sys,'v')
[r p k]=residue(num,den)
impulse(sys) % plots the impulse response of the LTI model

 Output :

num =
3 24 55 44

den =
1 8 17 10

Transfer function:
3 s^3 + 24 s^2 + 55 s + 44
--------------------------
s^3 + 8 s^2 + 17 s + 10

Zero/pole/gain:
3 (s+4.836) (s^2 + 3.164s + 3.033)
----------------------------------
(s+5) (s+2) (s+1)

z=
-4.8363
-1.5819 + 0.7282i
-1.5819 - 0.7282i

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [7]
p=
-5.0000
-2.0000
-1.0000

k=
3

r=
-0.5000
-2.0000
2.5000

p=
-5.0000
-2.0000
-1.0000

k=
3

Impulse Response
0.8

0.7

0.6

0.5
Amplitude

0.4

0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8
Time (sec)

 Problem – 2 :
The T.F. of a system is
G(s) = 2s + 5 .

s (s + 8s2 - s +8)
3

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [8]
Plot the step response of the system and determine the system dc gain.

U( t ) = 0 ;t<0
2 ; t ≥ 0 and t < 2
0.5 ; t ≥ 2

 Program :

num=[2 5];
den=conv([1 0], [1 8 -1 8]); % Convolution and polynomial multiplication.
sys=tf(num, den)
t=[0:.01:10];
'Response Vector Y for t vector'
y=step(sys,t)
dc_gain=dcgain(sys) % DC gain of LTI models.
pause % Wait for user response to strike any key before
plot(t,y) continuing.
grid % Grid lines. Sets the x,y & z grid properties of
the current axes.
axis([0 10 0 5]) % axis([xmin xmax ymin ymax]) sets scaling for the x-
and y-axes.

title(['system with dc gian of ', num2str(dc_gain)]) % num2str convert


numbers/matrix to a string representation T with about 4
digits &an exponent if required.
z1=zero(sys) % It gives vector of zeros.
[wn, d]=damp(sys) % Returns natural frequency & damping factor of the
systems.
u=d(3) % Third element of vector d.
text( 1.0, 1.3 ,['Zeta = ', num2str(u)]) % TEXT(X,Y,'string') adds the text in the
quotes to location (X,Y) on the current axes.

 Output :
num =
2 5
den =
1 11 41 61 30 0
Transfer function:
2s+5
-------------------------------------
s^5 + 11 s^4 + 41 s^3 + 61 s^2 + 30 s

dc_gain =
Inf

z1 =
-2.5000
wn =
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [9]
0
1.0000
2.0000
3.0000
5.0000
d=
-1
1
1
1
1
u=
1
system with dc gian of Inf
5

4.5

3.5

2.5

1.5

1 Zeta = 1

0.5

0
0 1 2 3 4 5 6 7 8 9 10

 Problem – 3:
Find the zero state response of the system given to the input.
G(s) = 3s + 2 .

2s +6s + 9s2 + 6s +1
4 3

 Program :
num=[3 2]
den=[1 2 2 3 5]
g=tf(num,den)
t=[0:0.1:4]; % Defines the range for vector t.
u(1:20,1)=2*ones(20,1) % ones(m, n) or ones([m, n]) is an MXN matrix of ones.
u(21:41,1)=0.5*ones(21,1)
y=lsim(g,u,t)
plot(t,y,t,u) % PLOT(X,Y) plots vector Y versus vector X.
text(1.15,1,' \leftarrow y(t)','FontSize',18)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [10]
text(1.9,1.6,' \leftarrow u(t) ','FontSize',18)
xlabel('TIME -->') % X-axis label.
ylabel('AMPLITUDE -->') % Y-axis label.
title('ZERO STATE RESPONCE') % Adds graph title.

 Output :

num = 3 2
den = 1 2 2 3 5
Transfer function:
3s+2
-----------------------------
s^4 + 2 s^3 + 2 s^2 + 3 s + 5
u=
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2
u=
2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000
2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000
2.0000 2.0000 2.0000 2.0000 0.5000 0.5000 0.5000 0.5000
0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000
0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000
0.5000

y=
0 0.0010 0.0075 0.0244 0.0558 0.1050 0.1748 0.2671 0.3831
0.5235 0.6880 0.8759 1.0855 1.3146 1.5604 1.8191 2.0868
2.3585 2.6290 2.8925 3.1429 3.3730 3.5728 3.7319 3.8406
3.8898 3.8715 3.7785 3.6046 3.3453 2.9973 2.5590 2.0304
1.4135 0.7123 -0.0671 -0.9167 -1.8261 -2.7830 -3.7729 -
4.7792

ZERO STATE RESPONCE


4

2
 u(t)
1  y(t)
AMPLITUDE -->

-1

-2

-3

-4

-5
0 0.5 1 1.5 2 2.5 3 3.5 4
TIME -->

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [11]
PRACTICAL - 3
AIM: - To Study programs for series,
parallel and feedback system.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [12]
AIM :- To Study programs for series, parallel and
feedback system.

 Problem – 1:

Create the series connection denoted by transfer function T(S) of the two
systems whose transfer functions are G1(s) and G2(s).

G1(s) = 2s + 9 . G2(s) = 5s .
s+3 (s - 1)

Give both TF and ZPK forms of the series connection and plot
the unit step response of G1, G2 and T (separately & also
combined).

 Program :

G1=tf([2 9],[1 3])


G2=tf([5 0],[1 -1])
T=series(G1,G2) % Series interconnection of the two LTI models.
x=zpk(T)
[z,p,k]=zpkdata(x,'v')
l=tfdata(G1); % Quick access to transfer function data. [NUM,DEN]
m=tfdata(G2); = TFDATA(SYS) returns the numerator(s) and
n=tfdata(T); denominator(s) of the transfer function SYS.
t=0:0.1:5;
subplot(4,1,1); % Create axes in tiled positions. H = SUBPLOT(m,n,p), or
SUBPLOT(mnp), breaks the Figure window into an m-by-n
matrix of small axes, selects the pth axes for the current plot &
returns the axes handle. The axes are counted along the top row
of the Figure window, then the second row, etc.
step(G1,t)
text(4,2.7,' \uparrow G1','FontSize',15)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF G1')
subplot(4,1,2);
step(G2,t) % STEP(SYS,T) uses the user-supplied time vector T for
simulation & plots the step response of the LTI model SYS

text(4,500,' \rightarrow G2','FontSize',15)


xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF G2')
subplot(4,1,3);
step(T,t)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [13]
text(4,1000,' \leftarrow T','FontSize',15)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF T')
subplot(4,1,4);
step(G1,G2,T,t) % STEP(SYS1,SYS2,..,T) plots the step response of multiple LTI
models SYS1,SYS2,.. on a single plot. The time vector T is optional.

text(4.5,2,' \leftarrow G1','FontSize',8)


text(4.5,700,' \leftarrow G2','FontSize',8)
text(4.5,1400,' \leftarrow T','FontSize',8)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF (G1,G2,T)')

 Output :

Transfer function:
2s+9
-------
s+3

Transfer function:
5s
-----
s-1

Transfer function:

10 s^2 + 45 s
-------------
s^2 + 2 s - 3

Zero/pole/gain:

10 s (s+4.5)
------------
(s+3) (s-1)
z=
0
-4.5000
p=
-3.0000
1.0000
k=
10

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [14]
AMPLITUDE -->
step response OF G1
3

2.5
 G1
2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)OF G2
AMPLITUDE -->

step response
1000

500  G2
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

step Time (sec)OF T


AMPLITUDE -->

response
4000

2000

0
T
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)
AMPLITUDE -->

step response OF (G1,G2,T)


4000

2000
T
 G2
0  G1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)

 Problem – 2 :

From the parallel connection of the two transfer functions,

1 ; H2(s) = H1(s) =
1 .
s-2 (s + 7)
Determine the zeros poles and gain of T(s) and compare them with the
corresponding parameters of H1(s) and H2(s) step response.

 Program :

h1=tf([1],[1 -2])
h2=tf([1],[1 7])
h= parallel(h1,h2) % connects the two LTI models in parallel
x=zpk(h)
[z,p,k]=zpkdata(x,'v')
k=tfdata(h);
t=0:0.1:5;
subplot(3,1,1);
step(h1,t)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF h1')
subplot(3,1,2);
step(h2,t)
xlabel('TIME -->')
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [15]
ylabel('AMPLITUDE -->')
title('step response OF h2')
subplot(3,1,3);
step(h,t)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response OF h')

 Output :

Transfer function:
1
-----
s-2

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

Transfer function:

2s+5
--------------
s^2 + 5 s - 14

Zero/pole/gain:

2 (s+2.5)
-----------
(s+7) (s-2)

z=
-2.5000

p=
-7
2
k=
2

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [16]
4 step response OF h1
x 10

AMPLITUDE -->
2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
TIME --> (sec)
step response OF h2
AMPLITUDE -->

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
TIME --> (sec)
4
x 10 step response OF h
AMPLITUDE -->

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
TIME --> (sec)

 Problem – 3 :

Obtain the response of the negative feedback system shown in fig and
find its step response.

R(s)

G1 C(s)
+
-

H1

 Program :

G1=tf([1 1],[1])
H1=tf([1 0],[1])
sys=feedback(G1,H1) % Computes an LTI model for the closed-loop feedback
system. Negative feedback is assumed.
t=0:0.1:10;

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [17]
step(sys,t)
title('Step Response of System')

 Output :

Transfer function:
s+1

Transfer function:
s

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

Step Response of System


1.4

1.2

0.8
Amplitude

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [18]
 Problem – 4 :

Connect four subsystems G1, G2, H1, and H2 as shown in figure.

G2
R(s) C(s)
G1 G3

H1
Obtain the step response of the overall system.

 Program :

display('G1(s) :'); %Display text. DISPLAY(X) is called for the object X when the
semicolon is not used to terminate a statement & to display array.
G1=tf([1 2],[1])
display('H1(s) :');
H1=tf([1 0],[1])
display('G2(s) :');
G2=tf([1],[1])
display('G3(s) :');
G3=tf([1],[1 2])
G4=feedback(G1,H1);
G5=parallel(G2,G3);
display('Total Transfer Function T(s) :');
T=series(G4,G5)
t=0:0.01:10;
step(T,t)
xlabel('TIME -->')
ylabel('AMPLITUDE -->')
title('step response of system')

 Output :
G1(s) :
Transfer function:
s+2
H1(s) :

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [19]
Transfer function:
s
G2(s) :
Transfer function:
1
G3(s) :
Transfer function:
1
-----
s+2
Total Transfer Function T(s) :
Transfer function:
s^2 + 5 s + 6
---------------------
s^3 + 4 s^2 + 5 s + 2

step response of system


3

2.5

2
AMPLITUDE -->

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9 10
TIME --> (sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [20]
PRACTICAL - 4
AIM: - To Study programs to find the time
response specifications.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [21]
AIM: - To Study programs to find the time response
specifications.

 Problem – 1:

Consider the first order system whose transfer function is defined by


H1(s) = 1 .

0.5s+2
Find time specifications & plot step & impulse response.

 Program :
clc; % Clears the command window.
clear all; % Removes all variables, globals,
functions and MEX links from memory.
num= input('Enter Numerator Part : '); % R = INPUT('How many apples') gives
the user the prompt in the text string and
den = input('Enter Denominator Part :'); then waits for input from the keyboard.
sys=tf(num,den)
zpk(sys,'v')
[Wn,Z]=damp(sys); % Returns vectors containing natural frequency
& damping of linear system dynamics.
fi=atan(sqrt(1-(Z(1)^2))/Z(1));
Wd=Wn(1).*(sqrt(1-(Z(1)^2))); % Sqrt finds square root.
tr=((pi-fi)./(Wd)) % PI represents the magnitude of 
ts=4./(Z(1).*Wn(1))
td=(1+((0.7).*Z(1)))./Wn(1)
subplot(2,1,1)
step(sys)
subplot(2,1,2)
impulse(sys)

 Output :

Enter Numerator Part : [1]


Enter Denominator Part :[0.5 1]

Transfer function:
1
---------
0.5 s + 1
Zero/pole/gain:
2
-----
(s+2)

tr =
Inf

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [22]
ts =
2
td =
0.8500

Step Response
1
System: sys
Time (sec): 2
Amplitude

Amplitude: 0.982
0.5

0
0 0.5 1 1.5 2 2.5 3
Time (sec)

Impulse Response
2

1.5
Amplitude

0.5

0
0 0.5 1 1.5 2 2.5 3
Time (sec)

 Problem – 2 :

Consider the second order system whose transfer functions are defined by
SYS(s) = 1 G(s) = . 1 H(s) = . 1 .

2 2 2
s +2s+1 s +4s+1 s +0.5s+1
Find time specifications & plot step & impulse response for all three
transfer functions. Compare time specification values and verify the
conclusion from the graph.

 Program :
disp('Critically damped system : ');
sys=tf([1],[1 2 1])
zpk(sys,'v')
[Wn,Z]=damp(sys);
fi=atan(sqrt(1-(Z(1)^2))/Z(1));
Wd=Wn(1).*(sqrt(1-(Z(1)^2)));
tr=((pi-fi)./(Wd))
ts=4./(Z(1).*Wn(1))
td=(1+((0.7).*Z(1)))./Wn(1)
tp=pi./Wd
mp=exp(-(Z(1).*pi.*Wn(1))./Wd)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [23]
disp('Overdamped system : ');
G=tf([1],[1 4 1])
zpk(G,'v')
[Wn,Z]=damp(G);
fi=atan(sqrt(1-(Z(1)^2))/Z(1));
Wd=Wn(1).*(sqrt(1-(Z(1)^2)));
tr=((pi-fi)./(Wd))
ts=4./(Z(1).*Wn(1))
td=(1+((0.7).*Z(1)))./Wn(1)
tp=pi./Wd

mp=exp(-(Z(1).*pi.*Wn(1))./Wd)
disp('Underdamped system : ');
H=tf([1],[1 0.5 1])
zpk(H,'v')
[Wn,Z]=damp(H);
fi=atan(sqrt(1-(Z(1)^2))/Z(1));
Wd=Wn(1).*(sqrt(1-(Z(1)^2)));
tr=((pi-fi)./(Wd))
ts=4./(Z(1).*Wn(1))
td=(1+((0.7).*Z(1)))./Wn(1)
tp=pi./Wd
mp=exp(-(Z(1).*pi.*Wn(1))./Wd)

step(sys,G,H)
impulse(sys,G,H)
 Output :
Critically damped system :

Transfer function:
1
-------------
s^2 + 2 s + 1
Zero/pole/gain:
1
-------
(s+1)^2
tr = Inf
ts = 4
td = 1.7000
tp = Inf
mp =0

Overdamped system :

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

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [24]
Zero/pole/gain:
1
--------------------
(s+3.732) (s+0.2679)
tr = Inf
ts = 14.9282
td = 6.3445
tp = Inf
mp = 0
Underdamped system :

Transfer function:
1
---------------
s^2 + 0.5 s + 1
Zero/pole/gain:
1
----------------
(s^2 + 0.5s + 1)
tr = 1.8833
ts = 16.0000
td = 1.1750
tp = 3.2446
mp = 0.4443

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [25]
 Conclusion :

Rise time (tr) is very high (∞) for overdamped & critically damped
systems and is small (few ones) for underdamped & undamped systems.
Settling time (ts) is very high (∞) for undamped system and small (few
ones) for underdamped, overdamped & critically damped systems.
Practically, for any system rise time & settling time should be small.
Underdamped system satisfies this criteria. This can be verified from
above graphs.

 Problem – 3 :
Consider the undamped system whose transfer functions is given by
H(s) = 1 .

2
s +1
Determine the time specifications and plot step & impulse response.
 Program :
disp('Undamped system : ');
sys=tf([1],[1 0 1])
zpk(sys,'v')
t=0:0.01:15;
u=ones(size(t)); % Ones array. It is the matrix of same size as t and all ones.
[y t]=lsim(sys,u,t); % Plots the time response of the LTI model SYS to the input
signal described by U and T. U is a matrix with as many columns

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [26]
as inputs & whose i-th row specifies the input value at time T(i).
Y = LSIM(SYS,U,T) returns the output history Y. No plot is
drawn on the screen.
lsimplot(sys,u,t) % Simulate time response of LTI models to arbitrary inputs.
grid on; % Adds major grid lines to the current axes.
stepinfo(y,t) % S = STEPINFO(Y,T,YFINAL) takes step response data (T,Y)
& a steady-state value YFINAL and returns a structure S
containing the step response characteristics. - rise time,
settling time, SettlingMin, SettlingMax, % overshoot, %
undershoot, peak absolute value & peak time.
u=zeros(size(t)); % Zeros array. It is the matrix of same size as t and all zeros.
u(1)=1; % First element of input vector. Here, impulse signal is defined.
[y t]=lsim(sys,u,t);
lsiminfo(y,t) % Computes linear response characteristics such as settling time,
minimum & maximum values of Y & corresponding time.
lsimplot(sys,u,t)
u=sin(t); % Defines input vector as a sine function of time vector.
lsimplot(sys,u,t)

 Output :

Undamped system :
Transfer function:
1
-------
s^2 + 1

Zero/pole/gain:
1
---------
(s^2 + 1)

ans =

RiseTime: 1.5918
SettlingTime: 14.9475
SettlingMin: 5.0731e-006
SettlingMax: 2.0000
Overshoot: 13.6564
Undershoot: 0
Peak: 2.0000
PeakTime: 3.1400

ans =

SettlingTime: 14.9554
Min: -0.0100
MinTime: 11
Max: 0.0100
MaxTime: 7.8600

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [27]
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [28]
 Problem – 4 :
Consider the unity feedback system whose transfer functions is given by
G(s) = 20 .

s(1+4s)(1+s)

Find Kv for the type one feedback system shown in problem & simulate
the unit ramp response of the closed loop system. Calculate E ss using
formula & verify with the result obtained in Matlab.

 Program :

clc;
clear all;
num=input('Enter Numerator Part : ');
den=input('Enter Denominator Part : ');
G=tf(num,den)
nums=conv([1 0],num);
sG=tf(nums,den)
sG=minreal(sG)
zpk(sG)
Kv=dcgain(sG)
ess=1./Kv
t=0:20:30000;
Y=step(G,t);
u=t;
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [29]
plot(t,Y,t,u)
grid on;

 Output :

Transfer function:
1
-----------
s^2 + 1.1 s

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

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

Zero/pole/gain:
1
-------
(s+1.1)

Kv = 0.9091

ess = 1.1000

4
x 10
3

2.5

1.5

0.5

0
0 0.5 1 1.5 2 2.5 3
4
x 10

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [30]
PRACTICAL - 5
AIM: - To Study programs to find the
poles and stability of the system.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [31]
AIM: - To Study programs to find the poles and stability
of the system.
Find the poles of following transfer function G(s) and determine whether
the system is stable. Plot poles and zeros of G(s) in S- plane. Finally
demonstrate the system stability and simulating impulse response and
step response. Comment on the system stability.

 Problem - 1 :

G(s) __ s2 - s - 2____
s3 + 7s2 + 20s + 24

 Program :

clc;
clear all;
num=input('Enter the numerator : ');
den=input('Enter the denominator : ');
sys=tf(num,den)
x=zpk(sys)
subplot(3,1,1)
pzmap(sys)
t=0:0.001:2.5;
[z p k]=zpkdata(sys,'v')
subplot(3,1,2)
impulse(sys,t)
subplot(3,1,3)
step(sys,t)
cnt=0;
for i=1:length(p) % Counter setup by loop to check stability
if p(i)>0 by loop variable i for number of poles times.
cnt=cnt+1;
end
end
if(cnt==0)
disp('system is stable');
else
disp('system is unstable');
end

 Output :
Enter the numerator : [1 -1 -2]
Enter the denominator : [1 7 20 24]

Transfer function:
s^2 - s - 2
-----------------------
s^3 + 7 s^2 + 20 s + 24
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [32]
Zero/pole/gain:
(s-2) (s+1)
--------------------
(s+3) (s^2 + 4s + 8)

z=
2
-1

p=
-3.0000
-2.0000 + 2.0000i
-2.0000 - 2.0000i

k=
1

system is stable

Pole-Zero Map
5
Imaginary Axis

-5
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Real Axis
Impulse Response
1
Amplitude

-1
0 0.5 1 1.5 2 2.5
Time (sec)
Step Response
0.2
Amplitude

-0.2
0 0.5 1 1.5 2 2.5
Time (sec)

 Problem - 2 :

G(s) = s-1 .
5 4
3 2
s + S + 2s + 2s + 3s +5

 Program :

clc;
clear all;
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [33]
close all;
num=input('Enter the numerator : ');
den=input('Enter the denominator : ');
sys=tf(num,den)
x=zpk(sys)
subplot(3,1,1)
pzmap(sys)
t=0:0.01:10;
[z p k]=zpkdata(sys,'v')
subplot(3,1,2)
impulse(sys,t)
subplot(3,1,3)
step(sys,t)
cnt=0;
for i=1:length(p)
if p(i)>0
cnt=cnt+1;
end
end
if(cnt==0)
disp('system is stable');
else
disp('system is unstable');
end

 Output :

Enter the numerator : [1 -1]


Enter the denominator : [1 1 2 2 3 5]

Transfer function:
s-1
------------------------------------------
s^5 + s^4 + 2 s^3 + 2 s^2 + 3 s + 5

Zero/pole/gain:
(s-1)
-------------------------------------------------------
(s+1.238) (s^2 - 1.441s + 1.878) (s^2 + 1.204s + 2.151)

z=
1

p=
0.7207 + 1.1656i
0.7207 - 1.1656i
-0.6018 + 1.3375i
-0.6018 - 1.3375i
-1.2378

k=
1
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [34]
system is unstable

Pole-Zero Map
2

Imaginary Axis
0

-2
-1.5 -1 -0.5 0 0.5 1
Real Axis
Impulse Response
200
Amplitude

-200
0 1 2 3 4 5 6 7 8 9 10
Time (sec)
Step Response
200
Amplitude

-200
0 1 2 3 4 5 6 7 8 9 10
Time (sec)

 Problem - 3 :

G(s) = 1 .
5 4 3 2
s + 6s + 15s + 30s +44s + 24

 Program :

clc;
clear all;
close all;
num=input('Enter the numerator : ');
den=input('Enter the denominator : ');
sys=tf(num,den)
x=zpk(sys)
subplot(3,1,1)
pzmap(sys)
t=0:0.01:20;
[z p k]=zpkdata(sys,'v')
subplot(3,1,2)
impulse(sys,t)
subplot(3,1,3)
step(sys,t)
cnt=0;
ms=0;
for i=1:length(p)
if (abs(real(p(i))/0.000001)) < 1 % Check whether absolute value of real
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [35]
part of pole is approximately zero (for M.S. system)
ms = ms +1;
else if p(i)>0
cnt=cnt+1;
end
end
end
if(cnt == 0)
if(ms == 0)
disp('system is stable');
else
disp('system is marginally stable');
end
else
disp('system is unstable');
end

 Output :

Enter the numerator : [1]


Enter the denominator : [1 6 15 30 44 24]

Transfer function:
1
-----------------------------------------
s^5 + 6 s^4 + 15 s^3 + 30 s^2 + 44 s + 24

Zero/pole/gain:
1
---------------------------
(s+2) (s+3) (s+1) (s^2 + 4)

z=
Empty matrix: 0-by-1

p=
-0.0000 + 2.0000i
-0.0000 - 2.0000i
-3.0000
-2.0000
-1.0000

k=
1

system is marginally stable

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [36]
Pole-Zero Map
2

Imaginary Axis
0

-2
-3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
Real Axis
Impulse Response
0.05
Amplitude

-0.05
0 2 4 6 8 10 12 14 16 18 20
Time (sec)
Step Response
0.1
Amplitude

0.05

0
0 2 4 6 8 10 12 14 16 18 20
Time (sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [37]
PRACTICAL - 6
AIM: - To Study programs related to
Bode plot

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [38]
AIM: - To Study programs related to Bode plot.

 Problem – 1 :

Example of Bode plot for Bode Gain Factor K.

 Program :

G=tf([2],[1]) % first system


f=tf([-5],[1]) % second system
w=0.01:10:100; %frequency vector
[mg1,pg1,Wr]=bode(G) %[MAG,PHASE,W] = BODE(SYS) return the response
magnitudes & phases in degrees (along with the frequency
vector W if unspecified). No plot is drawn on the screen.
bode(G,f) % BODE(SYS) draws the Bode plot of the LTI model
SYS.
BODE(SYS,W) uses the user-supplied vector W of
frequencies, in radian/second. BODE(SYS1,SYS2,...,W)
graphs the Bode response of multiple LTI models
SYS1,SYS2,... on a single plot.
 Output :

Transfer function: 2
Transfer function: -5
mg1(:,:,1) = 2
pg1(:,:,1) = 0

Bode Diagram
14

12
Magnitude (dB)

10

6
180

135
Phase (deg)

90

45

0
0 1
10 10
Frequency (rad/sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [39]
 Problem – 2 :

Example of Bode plot for Zeroes at Origin.

 Program :

G=tf([1 0 0 ],[1])
bode(G)

 Output :

Transfer function:
s^2

Bode Diagram
40

30
Magnitude (dB)

20

10

-10
181

180.5
Phase (deg)

180

179.5

179
0 1
10 10
Frequency (rad/sec)

 Problem – 3 :

Example of Bode plot for Poles at Origin.

 Program :

G=tf([1],[1 0 0 0])
bode(G)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [40]
 Output :

Transfer function:
1
---
s^3

Bode Diagram
20

0
Magnitude (dB)

-20

-40

-60
-269

-269.5
Phase (deg)

-270

-270.5

-271
0 1
10 10
Frequency (rad/sec)

 Problem – 4 :

Example of Bode plot for First Order Zeroes.

 Program :

G=tf([1 4],[1])
bode(G)

 Output :

Transfer function:
s+4

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [41]
Bode Diagram
40

35

Magnitude (dB)
30

25

20

15

10
90
Phase (deg)

45

0
-1 0 1 2
10 10 10 10
Frequency (rad/sec)

 Problem – 5 :

Example of Bode plot for First Order Poles.

 Program :

G=tf([1],[1 -5])
bode(G)

 Output :

Bode Diagram
-10

-15
Magnitude (dB)

-20

-25

-30

-35

-40
-90
Phase (deg)

-135

-180
-1 0 1 2
10 10 10 10
Frequency (rad/sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [42]
Transfer function:
1
-----
s-5

 Problem – 6 :

Example of Bode plot for Second Order Poles which indicates the error of
+13.97 dB for the value of  = 0.1 in the system transfer function.

 Program :

G=tf([1],[1 0.2 1])


bode(G)

 Output :

Bode Diagram
20

10
Magnitude (dB)

-10

-20

-30

-40
0

-45
Phase (deg)

-90

-135

-180
-1 0 1
10 10 10
Frequency (rad/sec)

Transfer function:
1
---------------
s^2 + 0.2 s + 1

 Problem – 7 :

Example of Bode plot for system with combination of above factors.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [43]
 Program :

G=tf([1],[1 22 40 0])
bode(G)
[Gm1,Pm1,Wcg1,Wcp1]=margin(G) %Computes the gain margin Gm, the phase
margin Pm, and the associated frequencies Wcg and Wcp.
Gm is absolute one in dB.

 Output :

Transfer function:
80
-------------------
s^3 + 22 s^2 + 40 s

Gm1 =
11.0000

Pm1 =
47.4040

Wcg1 =
6.3246

Wcp1 =
1.5688

Bode Diagram
50

0
Magnitude (dB)

-50

-100

-150
-90

-135
Phase (deg)

-180

-225

-270
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [44]
PRACTICAL - 7
AIM: - To Study programs related to
Root locus

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [45]
AIM: - To Study programs related to Root Locus.

 Problem – 1 :

Consider the system with the transfer function

G(s) = k .

s(s + 4)

Test a point s = -2 + j2.5 for its existence on root locus. Also find the
corresponding value of K.

 Program :

G=tf([1],[1 4 0])
T=zpk(G)
dc_gain = dcgain(T) % Computes the steady-state (D.C. or low frequency) gain of
the LTI model
rlocus(G) % Plots root locus of the system.
[k, clroot]=rlocfind(G) % Find root locus gains for given set of roots. Click on
plot & get values of k & corresponding close loop poles.

 Output :

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

Zero/pole/gain:
1
-------
s (s+4)

dc_gain =
Inf

Select a point in the graphics window


selected_point =
-1.9941 + 2.4922i

k=
10.2112

clroot =
-2.0000 + 2.4922i
-2.0000 - 2.4922i
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [46]
Root Locus
2.5

1.5

0.5
Imaginary Axis

-0.5

-1

-1.5

-2

-2.5
-4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis

 Problem – 2 :

Consider the system with the transfer function

G(s) = k .
s (s+1) (s+2)

Evaluate break away points. Also find the corresponding value of K.

 Program :

G=tf([1],[1 3 2 0])
T=zpk(G)
dc_gain = dcgain(T)
P = pzoptions; % Set the grid to on in options
P.Grid = 'on'; % Create plot with the options specified by P
h = rlocusplot(G,P); % Computes and plots the root locus of the single-input,
single-output LTI model system
p = getoptions(h); % Get options for plot
setoptions(h,p); % Apply options to plot
title (['System with dc gain ', num2str(dc_gain)]) % insert title
% T = NUM2STR(X) converts the matrix X into a string
representation T with about 4 digits and an exponent if required.
This is useful for labeling plots with the TITLE, XLABEL,
YLABEL, and TEXT commands.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [47]
[k, clroot]=rlocfind(G)

 Output :

Transfer function:
1
-----------------
s^3 + 3 s^2 + 2 s

Zero/pole/gain:
1
-------------
s (s+2) (s+1)

dc_gain =
Inf

Select a point in the graphics window


selected_point =
-0.4244 - 0.0068i

k=
0.3850
clroot =
-2.1547
-0.4226 + 0.0066i
-0.4226 - 0.0066i

System w ith dc gain Inf


5
0.72 0.6 0.46 0.3 0.16
0.84
4

3 0.92

2
0.98
1
Imaginary Axis

7 6 5 4 3 2 1
0

-1
0.98
-2

-3 0.92

-4
0.84
0.72 0.6 0.46 0.3 0.16
-5
-7 -6 -5 -4 -3 -2 -1 0 1 2
Real Axis

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [48]
By theatrical calculation, s1 = -0.423 & s2 = -1.577 are the break away points. Since,
the break away point must lie between 0 & -1 here, it is clear that s1 = -0.423
corresponds to actual break away point with K = 0.385

 Problem – 3 :

Find the root locus as K is varied from 0 to ∞. Also find the


corresponding value of K for the intersection of root locus branches with
the imaginary axis of a feedback control system whose open-loop transfer
function is given by

G(s) = k .
2
s (s+4)(s +4s+20)

 Program :

G=tf([1],[1 3 2 0])
T=zpk(G)
dc_gain = dcgain(T)
P = pzoptions;
P.Grid = 'on';
h = rlocusplot(G,P);
p = getoptions(h);
setoptions(h,p);
title (['System with dc gain ', num2str(dc_gain)])
[k, clroot]=rlocfind(G)

 Output :

Transfer function:
1
---------------------------
s^4 + 8 s^3 + 36 s^2 + 80 s

Zero/pole/gain:
1
-----------------------
s (s+4) (s^2 + 4s + 20)

dc_gain =
Inf

Select a point in the graphics window


selected_point =
0.0116 + 3.1352i

k=
259.1211

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [49]
clroot =
-3.9961 + 3.1598i
-3.9961 - 3.1598i
-0.0039 + 3.1598i
-0.0039 - 3.1598i

System w ith dc gain Inf


15 14
0.64 0.5 0.34 0.16
0.76 12
10
10
0.86 8
6
5 0.94 4
Imaginary Axis

0.985 2

0.985 2

-5 0.94 4
6
0.86 8
-10
10
0.76 12
0.64 0.5 0.34 0.16
-15 14
-15 -10 -5 0 5 10 15
Real Axis

 Problem – 4 :

Sketch the root locus diagram of a unity feedback control system having
open-loop transfer function

G(s) = k (s+1) .

s (s-1) (s2 + 4s + 16)

Find the frequency of oscillation & corresponding value of K. Find the


range of K for the stability of the system. Also obtain value of K when
=0.5 from root locus.

 Program :

G=tf([1],[1 3 2 0])
T=zpk(G)
dc_gain = dcgain(T)
P = pzoptions;

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [50]
P.Grid = 'on';
h = rlocusplot(G,P);
p = getoptions(h);
setoptions(h,p);
title (['System with dc gain ', num2str(dc_gain)])
sgrid(0.7, 10)
text(-15, 10 ,'Zeta line')
[k, clroot]=rlocfind(G)

 Output :

Transfer function:
s+1
---------------------------
s^4 + 3 s^3 + 12 s^2 - 16 s

Zero/pole/gain:
(s+1)
-----------------------
s (s-1) (s^2 + 4s + 16)

dc_gain =
Inf

(i) Select a point in the graphics window


selected_point =
0.0116 + 2.5703i

k=
35.8793

clroot =
0.0066 + 2.5731i
0.0066 - 2.5731i
-1.5066 + 1.7745i
-1.5066 - 1.7745i

Thus, kmar = 35.8 at mar =2.57

(ii)Select a point in the graphics window


selected_point =
0.0116 + 1.5529i

k=
23.1331

clroot =
-1.5052 + 2.7135i
-1.5052 - 2.7135i
0.0052 + 1.5500i
0.0052 - 1.5500i

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [51]
Thus, kmar = 23.13 at mar =1.55

System w ith dc gain Inf


20
20
0.66 0.52 0.4 0.26 0.12 17.5
15
15 0.8
12.5
10
10 0.9
7.5
5
5 0.97
Imaginary Axis

2.5

2.5
-5 0.97
5
7.5
-10 0.9
10
12.5
-15 0.8
15
0.66 0.52 0.4 0.26 0.12 17.5
-20
-20 -15 -10 -5 200 5 10
Real Axis

So, 23.13 ≤ K ≤ 35.87 for the system to be stable.

(iii) Select a point in the graphics window


selected_point =
-1.9651 + 3.4270i

k=
1.7636

clroot =
-1.9707 + 3.4225i
-1.9707 - 3.4225i
0.8000
0.1413

So, K = 1.76 at =0.5

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [52]
PRACTICAL - 8
AIM: - To Study programs related to
Nyquist plot & Nicholas plot

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [53]
AIM: - To Study programs related to Bode plot, Root
locus, Nyquist plot and Nicholas plot.

 Problem - 1 :
Example of Nyquist plot.
 Program :
G=tf([1],[1 1 0])
f=1:0.1:1000 ;
H=freqresp(G,f); % H = FREQRESP(SYS,W) computes the frequency
response H of the LTI model SYS at the frequencies
specified by the vector W.

F = frd(G,f); % SYS = FRD(RESPONSE,FREQS) creates an FRD


model SYS with response data in RESPONSE at frequency
points in FREQS. The output SYS is an FRD (Frequency
Response Data) model.
nyquist(F)

 Output :
Transfer function:
1
-------
s^2 + s

Nyquist Diagram
0.8

0.6

0.4

0.2
Imaginary Axis

-0.2

-0.4

-0.6

-0.8
-1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0
Real Axis

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [54]
 Problem - 2 :
Example of Nicholas plot.

 Program :

G=tf([1 ],[1 2])


w=0.01:10:100; % Generates frequency vector
nichols(G,{.001, 100}) % Plot for frequency range from 0.001 to 100
nichols(G,w); % Nicholas plot for frequency range w
ngrid % NGRID plots the Nichols chart grid lines over an
existing Nichols plot generated with NICHOLS.

 Output :

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

Nichols Chart
40
0 dB
30 0.25 dB
0.5 dB
20 1 dB -1 dB
Open-Loop Gain (dB)

10 3 dB
-3 dB
6 dB

0 -6 dB

-10 -12 dB

-20 -20 dB

-30

-40 dB
-40
-360 -315 -270 -225 -180 -135 -90 -45 0
Open-Loop Phase (deg)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [55]
PRACTICAL - 9
AIM: - To Study the transient response
of R-C & R-L-C Series Circuit

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [56]
AIM: - To design & implement the first & second order
control system by taking in the account R-C & R-L-C
series circuit and to find its transient response.
 Problem - 1 :
Consider the first order control system as shown in the circuit diagram.
Find out its transient response by applying square wave as an input &
also determine the resonant frequency.

 Circuit Diagram :
R1

10k

C1

OFFTIME = 62.8uS 1n
DSTM1
CLK ONTIME = 62.8uS
DELAY = 0
STARTVAL = 1
OPPVAL = 0

 Resonance frequency :

fr = 1 = 15.92 kHz . .

2 RC

Linear Simulation Results


0.1

System: sys System: sys


0.08
Time (sec): 3.15e-005 Time (sec): 9.43e-005
Amplitude: 0.0949 Amplitude: 0.0917
0.06

0.04 T = 9.43 - 3.15 = 0.628u


f = 15.92 kHz
0.02
Amplitude

-0.02

-0.04

-0.06

-0.08

-0.1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec) -4
x 10

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [57]
 Problem -2 :
Consider the second order system as shown in the circuit diagram. Find
out its transient response by applying square wave as an input & also
determine the resonance frequency.

 Circuit Diagram :
R1 L1
1 2
10k 1mH

C1

OFFTIME = 3.14uS 1n
DSTM1
CLK ONTIME = 3.14uS
DELAY = 0
STARTVAL = 1
OPPVAL = 0

 Transfer Function :
When we take the output across the capacitor
1 = 1 .= .=

T.F. = s LC + sRC + 1 10 s + 10-5s + 1


2 -6 2

 Program :
t=0:0.00000025:0.00001;
y=square(2*pi*1.5915e+005*t); %Generates square wave with frequency 159 kHz
plot(t,y)
sys=tf([1],[0.000001 0.00001 1])
lsimplot(sys,y,t)
 Output :
Transfer function:
1
--------------------------------
1e-006 s^2 + 1e-005 s + 1

 Resonance frequency :

fr = 1 . = 159.12 kHz
.

2LC

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [58]
Linear Simulation Results
1

0.8
T = 9.4 - 3.12 = 6.28 us
0.6 f = 159.15 kHz

0.4
System: sys System: sys
0.2 Time (sec): 3.12e-006 Time (sec): 9.4e-006
Amplitude: 4.86e-006 Amplitude: 1.48e-005
Amplitude

-0.2

-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec) -5
x 10

 When we take the output across the inductor,

s2LC .= = 10-6s2 .=

T.F. = s2LC + sRC + 1 10-6s2 + 10-5s + 1


 Program :
t=0:0.001:1;
y=0.00001*square(2*pi*1.5915e+005*t);
%plot(t,y)
sys=tf([0.000001 0 0],[0.000001 0.00001 1])
lsimplot(sys,y,t)

 Output :
Transfer function:

1e-006 s^2
-------------------------
1e-006 s^2 + 1e-005 s + 1

From figure, Mp = 0.18 mV =>  = 0.9488

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [59]
-4
x 10 Linear Simulation Results
2

1.5

0.5
Amplitude

-0.5

-1

-1.5

-2
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
Time (sec)

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [60]
PRACTICAL - 10
AIM: - Introduction to Simulink for
control system in matlab.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [61]
AIM: - Introduction to Simulink for control system in
matlab.
 Problem -1 :

Find step response of first order closed loop system shown below.

 Output :

 Problem -2 :

Find step response of the integrator circuit shown below.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [62]
 Output :

 Problem -3 :
Find the response of the integrator circuit shown below whose input is
ramp signal.

 Output :

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [63]
 Problem -4 :
Find the step response of the second order circuit shown below.

 Output :

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [64]
PRACTICAL - 9
AIM: - To Study programs related to controllability
and observability.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [65]
AIM: - To Study programs related to controllability
and observability.
Problem 1:
A control system is given by

A B

X1 3 0 0 X1 0 2

X2 = 0 1 0 X2 + 2 0 u1
X3 0 4 5 X3 0 1 u2

1 2 0 X1
Y= X2
0 1 0 X3

Determine the controllability and observability of the system using


matlab.

clc;
clear all;
a=[3 0 0;0 1 0;0 4 5];
b=[0 2;2 0;0 1];
c=[1 2 0;0 1 0];
x=rank([b a*b a^2*b])

y=rank([c' a*c' a^2*c'])

OUTPUT-
x=
3
y=
3

Problem 2:
Consider the system

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [66]
X1 3 0 0 X1
X2 = 0 1 0 X2
X3 0 4 5 X3

The output is given by

X1
Y= 1 1 1 X2
X3

(a)Determine the controllability and observability of the system using


matlab.
(b) Show that the system is completely observable if the output is given
by

y1 1 1 1 X1
= X2
y2 1 3 2 X3

clc;
clear all;
a=[3 0 0;0 1 0;0 3 2];
b=[0];
c1=[1 1 1];
y1=rank([c1' a*c1' a^2*c1'])

c2=[1 1 1;1 3 2];


y2=rank([c2' a*c2' a^2*c2'])

OUTPUT-
y1 = 3
y2 = 3

Problem 3:
Consider the following state equation and output equation.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [67]
X1 -1 -3 -2 X1 3

X2 = 0 -2 1 X2 + 0 u
X3 1 0 -1 X3 1

X1
Y= 1 1 0 X2
X3

Determine if the system is completely state controllable and


completely observable using MATLAB.

clc;
clear all;
a=[-1 -3 -2;0 -2 1;1 0 -1];
b=[3;0;1];
c=[1 1 0];
x=rank([b a*b a^2*b])

y=rank([c' a*c' a^2*c'])

OUTPUT-
x=
3
y=
3

Problem 4:

A control system is defined by the following state spall equation.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [68]
X1 -4 -1 X1 1
= + u
X2 2 -3 X2 3

X1
Y= 1 2
X3

Find the transfer function G(s) of the system using MATLAB.

clc;
clear all;
a=[-4 -1;2 -3];
b=[1;3];
c=[1 2];
d=[0];
z=ss(a,b,c,d);
G=tf(z)

OUTPUT-
Transfer function:
7 s + 28
--------------
s^2 + 7 s + 14

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [69]
PRACTICAL - 4
AIM: - To Study programs for Proportional Integral
and Proportional Integral Differential controller.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [70]
AIM: - To Study programs for Proportional Integral
and Proportional Integral Differential controller.
Problem – 1:
For the feedback control system shown in fig. with the process
and sensor model Gp(s) and H(s).

R(s)

Gc(s)
+ + Gp(s)
- +

Gp(s) = 4 .
(2s + 1) (0.55 + 1)

H (s) = 1 .
0.55 + 1

Design : -
1. Proportional Controller Gc(s).
2. Proportional Integral controller.
3. PID controller.

Programs for Proportional, PI and PID controller

(1) % Example of proportional control.

PROGRAM
Gp=tf([4], conv([2 1],[0.5 1]))
H=tf([1],[0.05 1])
t=[0:0.02:10]';
for KP=0.7:0.2:1.7;
T=feedback(KP*Gp,H,-1);
ys=step(T,t);
ref=dcgain(T);
%[Mo,tp,tr,ts,ess]=tstats(t,ys,ref);
%ymax=ys(find(t==tp));
%yss=ys(iength(ys));
%disp([KP ymax tp yss Mo])
plot(t,ys)
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [71]
if ishold~=1, hold on, end
end
hold off
OUTPUT-

(2) % Example of proportional integral (PI) control.

PROGRAM-
Gp=tf([4], conv([2 1],[0.5 1]))
H=tf([1],[0.05 1])
t=[0:0.02:10]';
KI=0.5%input('enter integral gain KI==>');
for KP=0.3:0.2:1.7
Kc=tf(KP*[1 KI],[1 0]);
T=feedback(Kc*Gp,H,-1);
ys=step(T,t);
%[Mo,tp,tr,ts,ess] = tstats(t,ys,1);
%ymax=ys(find(t==tp));
%yss=ys(iength(ys));
%disp([KP ymax tp yss Mo])
plot(t,ys)
if ishold~=1, hold on, end
end
hold off

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [72]
OUTPUT-

(2) % Example of proportional integral derivative (PID) control.

PROGRAM-
Gp=tf([4], conv([2 1],[0.5 1]))
H=tf([1],[0.05 1])
t=[0:0.02:10]';
KI=0.5%input('enter integral gain KI==>');
KD=0.3
for KP=0.3:0.2:1.7
Kc=tf(KP*[KD 1 KI],[1 0]);
T=feedback(Kc*Gp,H,-1);
ys=step(T,t);
%[Mo,tp,tr,ts,ess] = tstats(t,ys,1);
%ymax=ys(find(t==tp));
%yss=ys(iength(ys));
%disp([KP ymax tp yss Mo])
plot(t,ys)
if ishold~=1, hold on, end
end
hold off

OUTPUT-
Transfer function:
4
---------------
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [73]
s^2 + 2.5 s + 1

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

KI =
0.5000
KD =
0.3000

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [74]
PRACTICAL - 7
AIM: - To Study programs Related to state Space
Model.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [75]
AIM: - Programs Related to state Space Model.
Problem 1: % Example of state space models.

%Example: State space models


A=[1 2 3; 1 0 1;0 1 1];
B=[0;0;1];
C=[1 -1.5 0];
D=0;
Gss=ss(A,B,C,D)
Gtf=tf(Gss) % conversion from ss to TF
Gss1=ss(Gtf)
Gzpk=zpk(Gss) % Conversion from SS to ZPK
Gss2=ss(Gzpk)
[num,den]=tfdata(Gtf,'v')
[A1,B1,C1,D1]=tf2ss(num,den) % controller canonical form

OUTPUT-
a=
x1 x2 x3
x1 1 2 3
x2 1 0 1
x3 0 1 1

b= u1
x1 0
x2 0
x3 1

c=
x1 x2 x3
y1 1 -1.5 0
d=
u1
y1 0

Continuous-time model.

Transfer function:
1.5 s - 1
------------------------------
s^3 - 2 s^2 - 2 s + 6.014e-016

a=
x1 x2 x3
x1 2 1 -3.0069e-016
x2 2 0 0
x3 0 1 0
b=
u1

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [76]
x1 1
x2 0
x3 0
c=
x1 x2 x3
y1 0 0.75 -0.5
d=
u1
y1 0

Continuous-time model.

Zero/pole/gain:
1.5 (s-0.6667)
----------------------
s (s-2.732) (s+0.7321)

a=
x1 x2 x3
x1 2.7321 1.4371 0
x2 0 -0.73205 2
x3 0 0 3.0069e-016

b=
u1
x1 0
x2 0
x3 1.2247

c=
x1 x2 x3
y1 0.88007 0.61237 0

d=
u1
y1 0

Continuous-time model.

num =

0 0 1.5000 -1.0000

den =

1.0000 -2.0000 -2.0000 0.0000

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [77]
A1 =

2.0000 2.0000 -0.0000


1.0000 0 0
0 1.0000 0
B1 =

1
0
0
C1 =

0 1.5000 -1.0000
D1 =

Problem 2: % Example of state space models pole – zero map.

A=[1 2 3; 1 0 1;0 1 1];


B=[0;0;1];
C=[1 -1.5 0];
D=0;
G=ss(A,B,C,D)
[zG,Pg,Kg]=zpkdata(G,'v')
poleG=pole(G)
zeroG=tzero(G)
pzmap(G)
axis([-12 0 -3 3])

OUTPUT-
a=
x1 x2 x3
x1 1 2 3
x2 1 0 1
x3 0 1 1
b=
u1
x1 0
x2 0
x3 1
c=
x1 x2 x3
y1 1 -1.5 0
d=
u1
y1 0

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [78]
Continuous-time model.
zG =
0.6667

Pg =
2.7321
-0.7321
0.0000

Kg =
1.5000

poleG =
2.7321
-0.7321
0.0000

zeroG =
0.6667

Problem 3:
% Example for series, parallel and feedback of state model.
A1=[0 1; -3 -5];
B1=[0;1];
C1=[1 2];
D1=0;
A2=[-3 1; 0 -4];
B2=[0;4];
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [79]
C2=[3 0];
D2=2;
G1=ss(A1,B1,C1,D1)
G2=ss(A2,B2,C2,D2)
'series'
Ts=G1*G2
'parallel'
Tp=G1+G2
'feedback'
Tf=feedback(G1,G2)

OUTPUT-
a=
x1 x2
x1 0 1
x2 -3 -5
b=
u1
x1 0
x2 1
c=
x1 x2
y1 1 2
d=
u1
y1 0

Continuous-time model.

a=
x1 x2
x1 -3 1
x2 0 -4

b=
u1
x1 0
x2 4
c=
x1 x2
y1 3 0
d=
u1
y1 2

Continuous-time model.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [80]
ans =series
a=
x1 x2 x3 x4
x1 0 1 0 0
x2 -3 -5 3 0
x3 0 0 -3 1
x4 0 0 0 -4
b=
u1
x1 0
x2 2
x3 0
x4 4
c=
x1 x2 x3 x4
y1 1 2 0 0
d=
u1
y1 0
Continuous-time model.

ans = parallel
a=
x1 x2 x3 x4
x1 0 1 0 0
x2 -3 -5 0 0
x3 0 0 -3 1
x4 0 0 0 -4

b=
u1
x1 0
x2 1
x3 0
x4 4
c=
x1 x2 x3 x4
y1 1 2 3 0
d=
u1
y1 2

Continuous-time model.

ans = feedback
a=
x1 x2 x3 x4
x1 0 1 0 0
x2 -5 -9 -3 0
x3 0 0 -3 1

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [81]
x4 4 8 0 -4
b=
u1
x1 0
x2 1
x3 0
x4 0
c=
x1 x2 x3 x4
y1 1 2 0 0
d=
u1
y1 0

Continuous-time model.

Problem 4: Example of impulse and stepresponse of state space model.

A=[-2 -2.5 -0.5; 1 0 0; 0 1 0];


B=[1;0;0];
C=[0 1.5 1];
D=0;
Gss=ss(A,B,C,D)
t=[0:0.1:20]';
impulse(G,t)
pause
step(G,t)

a=
x1 x2 x3
x1 -2 -2.5 -0.5
x2 1 0 0
x3 0 1 0

b=
u1
x1 1
x2 0
x3 0

c=
x1 x2 x3
y1 0 1.5 1

d=
u1
4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [82]
y1 0

Continuous-time model.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [83]
GUJARAT
TECHNOLOGICAL
UNIVERSITY

EC DEPARTMENT

L.D. COLLE GE OF
ENGIN EE RING A H ME DA BA D-
380015

LABORATORY MANUAL
OF
CONTROL THEORY
(4th SEM. EC)

SUBJECT CODE: 141701


4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [84]
LIST OF PRACTICALS

Sr. Title Page


NO No
1. To Study Programs related to transfer function, 1
partial fraction expansion and roots.

2. To Study Programs for transient response


analysis.

3. To Study Programs for series, parallel and


feedback system.

4. To Study Programs to find the time response


specifications.

5. To Study Program to find the poles and stability


of the system
6. To Study Programs related to Bode plot.

7. To Study Programs related to Root locus

8. To study Programs related to Nyquist plot and


Nicholas plot

9. To Study the transient response of the R-C & R-


L-C circuit.

10. Introduction to Simulink for control system in


matlab.

4th E.C. - L.D. College of Engineerin | Control System LAB MANUAL [85]

You might also like