0% found this document useful (0 votes)
88 views

Experiment # 14 Analysis and Design by Root Locus Using MATLAB

The document contains MATLAB code for analyzing and designing control systems using root locus analysis. It includes code to plot root loci for various open-loop transfer functions with varying gain (K) and analyze the system behavior. It also contains code to plot step and unit-ramp responses of compensated and uncompensated systems.

Uploaded by

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

Experiment # 14 Analysis and Design by Root Locus Using MATLAB

The document contains MATLAB code for analyzing and designing control systems using root locus analysis. It includes code to plot root loci for various open-loop transfer functions with varying gain (K) and analyze the system behavior. It also contains code to plot step and unit-ramp responses of compensated and uncompensated systems.

Uploaded by

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

Experiment # 14

Analysis and design by root locus


using MATLAB
6.1

>> num = [1 3];

den = [1 5 20 16 0];

h=tf([1 3],[1 5 20 16 0]);

rlocus(h)

v=[-6 6 -6 6];

axis(v);

>> grid;

>>

6.2

>> num = [1];

den = [1 1.1 10.3 5 0];

>> h=tf([1],[1 1.1 10.3 5 0]);

>> rlocus(h)

>> v=[-6 6 -6 6];axis(v)

>> grid

>>

6.3
num = [1];
den = [1 1.1 10.3 5 0];
K1 = 0:0.2:20;
K2 = 20:0.1:30;
K3 = 30:5:1000;
K = [K1 K2 K3];
r = rlocus(num,den,K);
plot(r, 'o')
v = [-4 4 -4 4]; axis(v)
grid
title('Root-Locus Plot of G(s) = K/[s(s + 0.5)(s^2
+ 0.6s + 10)]')

6.4

>> A = [0 1 0;0 0 1;-160 -56 -14];

B = [0;1;-14];

C = [1 0 0];

D = [0];

K = 0:0.1:400;

rlocus(A,B,C,D,K);

>> v = [-20 20 -20 20]; axis(v)

grid

title('Root-Locus Plot of System Defined in State


Space')

6.5

>> sgrid

>> v=[-3 3 -3 3];axis(v);

>> title('Constant \zeta Lines and Constant


\omega_n Circles')

xlabel('Real Axis')

ylabel('Imag Axis')

6.6:
>> num = [1];
den = [1 4 5 0];
K = 0:0.01:1000;
r = rlocus(num,den,K);
>> plot(r,'-'); v = [-3 1 -2 2]; axis(v);
>> sgrid([0.5,0.707], [0.5,1,2])
grid
title('Root-Locus Plot with \zeta = 0.5 and 0.707 Lines and \omega_n = 0.5,1, and 2 Circles')
xlabel('Real Axis'); ylabel('Imag Axis')
gtext('\omega_n = 2')
gtext('\omega_n = 1')
gtext('\omega_n = 0.5')
% Place 'x' mark at each of 3 open-loop poles.
gtext('x')
gtext('x')
gtext('x')
6.7
>> num = [1 2 4];
den = conv(conv([1 4 0],[1 6]), [1 1.4 1]);
rlocus(num, den)
v = [-7 3 -5 5]; axis(v);
grid
title('Root-Locus Plot of G(s) = K(s^2 + 2s +
4)/[s(s + 4)(s + 6)(s^2 + 1.4s + 1)]')
text(1.0, 0.55,'K = 12')
text(1.0,3.0,'K = 73')
text(1.0,4.15,'K = 154')

6.8
num = [-0.5 1];
den = [1 1 0];
k1 = 0:0.01:30;
k2 = 30:1:100;
K3 = 100:5:500;
K = [k1 k2 k3];
rlocus(num,den,K)
v = [-2 6 -4 4]; axis(v); axis('square')
grid
title('Root-Locus Plot of G(s) = K(1 - 0.5s)/[s(s + 1)]')
% Place 'x' mark at each of 2 open-loop poles.
% Place 'o' mark at open-loop zero.
gtext('x')
gtext('x')
gtext('o')

6.9

num1 = [12.287 23.876];


den1 = [1 5.646 16.933 23.876];
num2 = [9];
den2 = [1 3 9];
num = [10];
den = [1 1 10];
t = 0:0.05:5;
c1 = step(num1,den1,t);
c2 = step(num2,den2,t);
c = step(num,den,t);
plot(t,c1,'-',t,c2,'.',t,c,'x')
grid
title('Unit-Step Responses of Compensated Systems and
Uncompensated System')
xlabel('t Sec')
ylabel('Outputs c1, c2, and c')
text(1.51,1.48,'Compensated System (Method 1)')
text(0.9,0.48,'Compensated System (Method

6.10
num1 = [12.287 23.876];
den1 = [1 5.646 16.933 23.876 0];
num2 = [9];
den2 = [1 3 9 0];
t = 0:0.05:5;
c1 = step(num1,den1,t);
c2 = step(num2,den2,t);
plot(t,c1,'-',t,c2,'.',t,t,'-')
grid
title('Unit-Ramp Responses of Compensated Systems')
xlabel('t Sec')
ylabel('Unit-Ramp Input and Outputs c1 and c2')
text(2.55,3.8,'Input')
text(0.55,2.8,'Compensated System (Method 1)')
text(2.35,1.75,'Compensated System (Method 2)')
6.11

numc = [1 0.05];
denc = [1 3.005 2.015 0.01 0];
num = [1.06];
den = [1 3 2 0];
% ***** Enter rlocus command. Plot the root loci of
both
% systems *****
rlocus(numc,denc)
hold
Current plot held
rlocus(num,den)
v = [-3 1 -2 2]; axis(v); axis('square')
grid
text(-2.8,0.2,'Compensated system')
text(-2.8,1.2,'Uncompensated system')
text(-2.8,0.58,'Original closed-loop pole')
text(-0.1,0.85,'New closed-')
text(-0.1,0.62,'loop pole')
title('Root-Locus Plots of Compensated and
Uncompensated Systems')
hold
Current plot released
% ***** Plot root loci of the compensated system near the origin *****
rlocus(numc,denc)
v = [-0.6 0.6 -0.6 0.6]; axis(v); axis('square')
grid
title('Root-Locus Plot of Compensated System near the Origin')

6.12

numc = [1.0235 0.0512];


denc = [1 3.005 2.015 1.0335 0.0512 0];
num = [1.06];
den = [1 3 2 1.06 0];
% ***** Specify the time range (such as t= 0:0.1:50)
and enter
% step command and plot command. *****
t = 0:0.1:50;
c1 = step(numc,denc,t);
c2 = step(num,den,t);
plot(t,c1,'-',t,c2,'.',t,t,'--')
grid
text(2.2,27,'Compensated system');
text(26,21.3,'Uncompensated system');
title('Unit-Ramp Responses of Compensated and
Uncompensated Systems')
xlabel('t Sec');
ylabel('Outputs c1 and c2')
6.13

numc = [1.0235 0.0512];


denc = [1 3.005 2.015 1.0335 0.0512];
num = [1.06];
den = [1 3 2 1.06];
% ***** Specify the time range (such as t = 0:0.1:40)
and enter
% step command and plot command. *****
t = 0:0.1:40;
c1 = step(numc,denc,t);
c2 = step(num,den,t);
plot(t,c1,'-',t,c2,'.')
grid
text(13,1.12,'Compensated system')
text(13.6,0.88,'Uncompensated system')
title('Unit-Step Responses of Compensated and
Uncompensated Systems')
xlabel('t Sec')
ylabel('Outputs c1 and c2')

6.14
num1 = [20];
den1 = [1 5 12.98 20];
num2 = [20];
den2 = [1 5 32.26 20];
t = 0:0.1:10;
c1 = step(num1,den1,t);
c2 = step(num2,den2,t);
plot(t,c1,t,c2)
text(2.5,1.12,'k = 0.4490')
text(3.7,0.85,'k = 1.4130')
grid
title('Unit-step Responses of Two Systems')
xlabel('t Sec')
ylabel('Outputs c1 and c2')

6.15

num = [1];
den = [1 3 2 0];
numa = [1];
dena = [1 3 3 1];
K1 = 0:0.1:0.3;
K2 = 0.3:0.005:0.5;
K3 = 0.5:0.5:10;
K4 = 10:5:100;
K = [K1 K2 K3 K4];
r = rlocus(num,den,K);
a = rlocus(numa,dena,K);
y = [r a];
plot(y,'-')
v = [-4 4 -4 4]; axis(v)
grid
title('Root-Locus Plot of G(s) = K/[s(s + 1)(s + 2)] and Asymptotes')
xlabel('Real Axis')
ylabel('Imag Axis')

6.16

num = [1];
den = [1 3 2 0];
numa = [1];
dena = [1 3 3 1];
K1 = 0:0.1:0.3;
K2 = 0.3:0.005:0.5;
K3 = 0.5:0.5:10;
K4 = 10:5:100;
K = [K1 K2 K3 K4];
r = rlocus(num,den,K);
a = rlocus(numa,dena,K);
plot(r,'o')
hold
Current plot held
plot(a,'-')
v = [-4 4 -4 4]; axis(v)
grid
title('Root-Locus Plot of G(s) = K/[s(s+1)(s+2)] and
Asymptotes')
xlabel('Real Axis')
ylabel('Imag Axis')

6.17

num = [1];
den = [1 4 11 14 10];
numa = [1];
dena = [1 4 6 4 1];
r = rlocus(num,den);
plot(r,'-')
hold
Current plot held
plot(r,'o')
rlocus(numa,dena);
v = [-6 4 -5 5]; axis(v); axis('square')
grid
title('Plot of Root Loci and Asymptotes')
6.18

num = [1 1];
den = [1 4 11 14 10];
K1 = 0:0.1:2;
K2 = 2:0.0.2:2.5;
K3 = 2.5:0.5:10;
K4 = 10:1:50;
K = [K1 K2 K3 K4]
r = rlocus(num,den,K);
plot(r, 'o')
v = [-8 2 -5 5]; axis(v); axis('square')
grid
title('Root-Locus Plot of G(s) = K(s+1)/[(s^2+2s+2)
(s^2+2s+5)]')
xlabel('Real Axis')
ylabel('Imag Axis')

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy