0% found this document useful (0 votes)
2 views2 pages

CS Lab 09

The document contains MATLAB code for performing root locus analysis on the transfer function G(s)H(s) = K(s+3)/(s(s+1)(s+2)(s+4)). It includes calculations for the centroid and angles of asymptotes, as well as visualizations such as the pole-zero map and root locus plot. Additionally, it estimates the gain K at a specific point on the root locus.
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)
2 views2 pages

CS Lab 09

The document contains MATLAB code for performing root locus analysis on the transfer function G(s)H(s) = K(s+3)/(s(s+1)(s+2)(s+4)). It includes calculations for the centroid and angles of asymptotes, as well as visualizations such as the pole-zero map and root locus plot. Additionally, it estimates the gain K at a specific point on the root locus.
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/ 2

Matlab Code:

% Root Locus Analysis for G(s)H(s) = K(s+3)/(s(s+1)(s+2)(s+4))

clc;
clear;
close all;

% Define numerator and denominator of open-loop transfer function


num = [1 3]; % (s + 3)
den = conv([1 0], conv([1 1], conv([1 2], [1 4]))); % s(s+1)(s+2)(s+4)

% Create transfer function


G = tf(num, den);

% Display the transfer function


disp('Open-loop Transfer Function G(s):');
G

% Plot the root locus


figure;
rlocus(G)
title('Root Locus of G(s)H(s) = K(s+3)/(s(s+1)(s+2)(s+4))');
grid on;

% Add pole-zero map for visualization


figure;
pzmap(G)
title('Pole-Zero Map of G(s)');
grid on;

% Calculate and display the centroid and angles of asymptotes


poles = roots(den);
zeros = roots(num);

n_poles = length(poles);
n_zeros = length(zeros);

% Centroid
sigma_a = (sum(poles) - sum(zeros)) / (n_poles - n_zeros);
disp(['Centroid of asymptotes: ', num2str(sigma_a)]);

% Angles of Asymptotes
fprintf('Angles of asymptotes (degrees):\n');
for k = 0:(n_poles - n_zeros - 1)
theta = (2*k + 1) * 180 / (n_poles - n_zeros);
fprintf(' θ_%d = %.2f°\n', k, theta);
end

% Estimate gain at a specific point (e.g., s = -2.3)


s_break = -2.3;
K_break = abs(evalfr(G, s_break))^(-1); % |1/G(s)|
disp(['Estimated K at breakaway point s = -2.3: ', num2str(K_break)]);
Fig-1: Result of determination of Centroid and Angles of assymptotes.

Fig-02: Pole-Zero Map of the Transfer Function.

Fig-03: Root Locus of the Transfer Function.

You might also like