Clear Filters
Clear Filters

How do I calculate the gain at a point on the root locus

4 views (last 30 days)
I am trying to generate the gain "K" at a point (anypoint) on the root locus using the charastic equation. 1 + KGsHs = 0. So K = -(D(s)/N(s))
Example from Control Systems Engineering (Norman Nice)
Steps, 1) generate num and den as normal
2) Give s a reference value eg 1.6 + 1.6i
3) multiply the coeficient by the required value of s
This where I have the problem:
The den is a row vector, that is the coefficients are listed in decreasing powers of s. Having multiplied the coefficients by the point value, that must now be praise to the level of the elements power. eg the first element of pg is 1.6+1.6i which is now the new coefficient of s^2
So K = s^2+s^1+s^0
I have attempted varios ways to achieve that but have failed. My last effort was the for loop as shown below.
If any one can show where I have gone wrong I would appreciate it
Thanks and regards.
clear all;
close all;
clc;
syms s
s = tf('s');
H = 1;
num = 1+0j
num = 1
den = [1 3 0] %den =(s^2 + 3s)
den = 1×3
1 3 0
G = tf(num,den)
G = 1 --------- s^2 + 3 s Continuous-time transfer function.
pG1 = [0]
pG1 = 0
P1 = -1.6+1.6i % the point at which I want the gain value
P1 = -1.6000 + 1.6000i
%therefore "s" = P1
%denPoly = poly2sym(den, s)
K = 0
K = 0
pg = P1.*den % I can multiply the den elements by
pg =
-1.6000 + 1.6000i -4.8000 + 4.8000i 0.0000 + 0.0000i
% the point value P1
% The output looks correct, as a row
% vector I know the final value should
% be 3
for n = length(den) : 1
n
m = (length(den) - n) % I have tried to calculate j to
% represent the power from placement
pG1(n) = pg(n).^m
end

Answers (1)

Paul Buckman
Paul Buckman on 2 Dec 2023
I hope that I am not messing people arround but:
I got around the problem above this way: new array psden to hold the powers of den from sC to 0
clear all; close all; clc;
syms s
s = tf('s');
H = 1;
num = 1+0j
num = 1
den = [1 3 0] %den =(s^2 + 3s)
den = 1×3
1 3 0
G = tf(num,den)
G = 1 --------- s^2 + 3 s Continuous-time transfer function.
[sR, sC] = size(den)
sR = 1
sC = 3
psden = sC-1:-1:0 %
psden = 1×3
2 1 0
pG1 = zeros(sR,sC)
pG1 = 1×3
0 0 0
P1 = -1.6+1.6i % the point at which I want the gain value
P1 = -1.6000 + 1.6000i
%therefore "s" = P1
%denPoly = poly2sym(den, s)
K = 0
K = 0
pg = P1.*den % I can multiply the den elements by
pg =
-1.6000 + 1.6000i -4.8000 + 4.8000i 0.0000 + 0.0000i
% the point value P1
% The output looks correct, as a row
% vector
pG1 = pg.^psden
pG1 =
0.0000 - 5.1200i -4.8000 + 4.8000i 1.0000 + 0.0000i
Now pG1(3) does not look correct as any number^0 = 0 can anyone explain this please or am I in error again.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!