Clear Filters
Clear Filters

Facing problem in printing real pole of transfer function of a system(Control System)

43 views (last 30 days)
In the program given below I fail to obtaine real pole as title in intger format if anyone know please guide me
(In Output as title of root locus I wish to print 'Root locus of,1,2.00000+-2.00000i,1' rather output obtained as 'Root locus of,1,2.00000+-2.00000i,0-1.00000e+00' i.e real pole in exponetial form is printed which should be in real niumber)
num1=[1 -1];
den1=conv([1 1],conv([1 2+2j],[1 2-2j]));
G=tf(num1,den1);
P=pole(G);
Z = zero(G);
formatSpec='%s,%i,%f+%fi,%i';
a="Root Locus of ";
b='step response of';
figure(17)
rlocus(G)
p=sprintf(formatSpec,a,Z,P/1i,P(3,1));
title(p);

Answers (1)

Sam Chak
Sam Chak on 27 Jun 2024 at 10:01
The following is what you wish to "print" out in the title in Integer format. However, please note that the title itself might be confusing, even to experts in control theory.
num = [1 -1];
den = conv([1 1],conv([1 2+2j],[1 2-2j]));
G = tf(num, den)
G = s - 1 ---------------------- s^3 + 5 s^2 + 12 s + 8 Continuous-time transfer function.
P = pole(G) % poles
P =
-2.0000 + 2.0000i -2.0000 - 2.0000i -1.0000 + 0.0000i
Z = zero(G) % zeros
Z = 1
%% check what they
P/1i
ans =
2.0000 + 2.0000i -2.0000 + 2.0000i 0.0000 + 1.0000i
P(3,1)
ans = -1.0000
% formatting
formatSpec = '%s, %i, %.f+%.fi, %.f';
a = "Root Locus of ";
b = 'step response of';
figure(17)
rlocus(G), grid on % create root locus diagram
% check title
tit = sprintf(formatSpec, a, Z, P(1:2)/1i, -P(3,1))
tit = 'Root Locus of , 1, 2+-2i, 1'
title(tit);

Community Treasure Hunt

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

Start Hunting!