Root Locus Plot Is Way Off
33 次查看(过去 30 天)
显示 更早的评论
If anyone knows how to use matlab, can someone explain what is going wrong.
I am working on a project for a class called Linear Systems. I am plotting a root locus and it is supposed to have a curve that goes through 2 desired poles but its so off and its not even funny. I have a transfer function with desired poles.
This is my code: (The first section is very similar to my professors. Its the second section that is just way off).
sys = tf(0.03965,[5.28e-08,1.856e-05,0.00080187,0]);
rlocus(sys)
hold on;
plot(-7.9,11.85,'rx')
plot(-7.9,-11.85,'rx')
% sys_new = tf([10],[1 5])*tf([1],[1 60])*tf([1],[1 0])*tf([1 13.33],[1])
sys_new = tf(0.03965,[5.28e-08, 1.856e-05, 0.00080187, 0])*tf([1 22.835],1);
figure()
rlocus(sys_new)
hold on;
% plot(-20,20,'rx')
% plot(-20,-20,'rx')
plot(-7.9,11.85,'rx')
plot(-7.9,-11.85,'rx')
The part of the code with % is my professors.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552157/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552162/image.png)
0 个评论
回答(4 个)
Paul
2023-11-26
Hi Arpad,
Let's take a look at that root locus for the uncompensated system. I asusme that the red x's indicate the desired closed loop pole locations after compensation.
sys = tf(0.03965,[5.28e-08,1.856e-05,0.00080187,0]);
rlocus(sys)
hold on;
plot(-7.9,11.85,'rx')
plot(-7.9,-11.85,'rx')
Now add the compensation, which is a single zero at s = -22.835. Also, it's better use sys to define sysnew to avoid typos or copy/paste errors.
% sys_new = tf([10],[1 5])*tf([1],[1 60])*tf([1],[1 0])*tf([1 13.33],[1])
%sys_new = tf(0.03965,[5.28e-08, 1.856e-05, 0.00080187, 0])*tf([1 22.835],1);
sys_new = sys*tf([1 22.835],1);
figure()
rlocus(sys_new)
hold on;
% plot(-20,20,'rx')
% plot(-20,-20,'rx')
plot(-7.9,11.85,'rx')
plot(-7.9,-11.85,'rx')
So I guess the question is what is the basis for thinking that adding the zero at s = -22 would cause the root locus to go through, or even near, the desired pole locations. As shown, the compensator zero results in a real closed loop pole somewhere between the zero and the plant pole near the orign. If you put the compensator zero to the left of the plant pole at s = -50, the root locus will qualitatively look more like the "proferssor's solution", but the loci will be pulled much further to the left than the desired closed-loop poles. So maybe a single compensator zero isn't sufficient for this plant and the desired closed-loop pole locations.
26 个评论
Paul
2023-11-27
In your original code you had this term
tf([1 22.835],1)
which has one zero at s0 = -22.835 and no poles. So you need to figure out how to change that tf command to represent a pole at s0 = -22.835 and no zeros. If you don't know how to that, I suggest checking the doc page for tf. Or, it might be more intuitive to use a zpk form and convert it to a tf. For example
tf(zpk(-22.835,[],1)) % same as above.
Strictly speaking, it's not necssary to convert the zpk to a tf. I just did that here for comparison to your original tf.
BTW, that was a nice idea to use the angle criterion to determine the pole location of the compensator.
Paul
2023-12-2
编辑:Paul
2023-12-2
The Symbolic Toolbox can be helpful in solving a problem like this.
Define the plant and the desired location of the dominant pair of complex poles.
sys = tf(0.03965,[5.28e-08,1.856e-05,0.00080187,0]);
pdes = -7.9+1j*11.85;
Define the plant symbolically
syms s
P(s) = simplify(poly2sym(sys.num{1},s)/poly2sym(sys.den{1},s));
Asusme we want to us a single-pole compensator
syms p real
K(s) = 1/(s + p);
Solve for the value of p that satifsfies the root locus angle criteria
sol.p = solve(angle(P(pdes)*K(pdes))==sym(pi),p);
double(sol.p)
Same value as found above. Plot the root locus using this compensation
figure
rlocus(sys*tf(1,[1 double(sol.p)])),
hold on
plot(pdes,'r*')
plot(conj(pdes),'r*')
axis([-30 0 -70 70])
The compensator pole introduces a breakaway point on the real axis to the left of the desired poles and the loci migrate to the right through the desired pole locations as the gain increases.
Assume we want a compensator with one zero and one pole
syms z real
K(s) = (s+z)/(s+p);
Solve for the locations based on the angle criteria. Because we have one equation in two unknowns, we solve for one in terms of the other. I chose to solve for p in terms of z.
sol = solve(angle(P(pdes)*K(pdes))==sym(pi),p,'ReturnConditions',true);
Pick a value of z. Here, I'm using the value of z as was originally defined in the question.
z = 22.835;
Get the value of p that corresponds to that value of p.
p = double(subs(sol.p,z))
Plot the root locus.
figure
rlocus(sys*tf([1 z],[1 p])),
hold on
plot(pdes,'r*')
plot(conj(pdes),'r*')
axis([-30 0 -70 70])
We see that shifting the compensator pole to lower frequency yields a breakaway point the right of the desired pole locations and the compensator plays its role as an attractor to bring the loci to the left through the desired pole locations before the loci evetually migrate toward the RHP as the gain increases.
Sam Chak
2023-11-26
Hi @Arpad
I am uncertain about what your professor intends for you to learn. Initially, the problem seems akin to a standard Pole Placement issue. However, upon delving into it for several hours, it emerges as a mathematically challenging problem, particularly if you aim to precisely align the root locus to traverse the two specified closed-loop poles while exhibiting the desired 2nd-order system behavior simultaneously.
From the given complex poles
, a reference 2nd-order system can be formulated as
. Although you suggested an improper compensator, for practical systems, a strictly proper compensator is preferable, wherein the numerator's degree is lower than that of the denominator.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552627/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1552632/image.png)
Essentially, as previously mentioned, this problem can be tackled using pole placement only when all desired poles are known, as is the case in most exercises. However, the plant system is of 3rd-order, and only two desired closed-loop poles are known. Hence, the dominant pole approximation method can be employed. You can explore this topic on Google, or it may already be covered in your professor's lectures.
In my proposed solution, I opted for a relatively high-order but strictly proper compensator.
s = tf('s');
% 3rd-order Plant transfer function
Gp = tf(0.03965, [5.28e-8 1.856e-5 0.00080187 0])
% A relatively high-order Compensator (but strictly proper)
a1 = 31264.2848484848;
a2 = 363954426.075654;
a3 = 1849668573733.87;
b1 = 4355207983.5442;
b2 = 45076892441.6564;
b3 = 1052053220570.43;
c1 = 241.562107836302;
d1 = 10.3501124658055;
d2 = c1;
G1 = (b1*s^2 + b2*s + b3)/(s^3 + a1*s^2 + a2*s + a3);
G2 = tf(c1, [1 d1 d2]);
% My compensator formula (maybe it appears in literature, I didn't check)
Gcom = G2*G1/(1 + G1*Gp - G2*G1*Gp);
Gcom = minreal(Gcom)
% Closed-loop system
Gcls = minreal(feedback(Gcom*Gp, 1))
% Check closed-loop system poles
CL_poles = pole(Gcls);
CL_poles(19:20)
% Plot Step response
figure(1)
step(Gcls, 1), hold on
% Compare with the reference 2nd-order Transfer function
Gref = 202.833/(s^2 + 15.8*s + 202.833)
step(Gref, 1), grid on, hold off
legend('Closed-loop system', '2nd-order system')
% Plot Root Locus
figure(2)
rlocus(Gcom*Gp), hold on
plot(-7.9, 11.85, 'rx', 'markersize', 12, 'linewidth', 3)
plot(-7.9, -11.85, 'rx', 'markersize', 12, 'linewidth', 3)
axis([-10 -6 -20 20]), hold off
0 个评论
Sam Chak
2023-11-26
Hi @Arpad
It seems that employing the place() command is a more efficient approach to solving the pole placement problem. I will leave the task of converting the matrix gain K to the compensator transfer function as an exercise for you. Please verify this with your professor.
% Plant
Gp = tf(0.03965, [5.28e-8 1.856e-5 0.00080187 0])
% Convert Plant TF to State-Space
sys = ss(Gp)
% Make desired closed-loop poles
coef = conv([1 15.8 202.833], [1 7.9e3]); % dominant pole technique
p = roots(coef)
% Find gain matrix K to place closed-loop poles at desired locations
A = sys.A;
B = sys.B;
K = place(A, B, p)
% Closed-loop system
Acl = A - B*K;
syscl = ss(Acl, B, sys.C, sys.D);
N = 1/dcgain(syscl); % Input scaler
syscl = ss(Acl, B*N, sys.C, sys.D);
Pcl = pole(syscl) % if K is correctly designed, then Pcl = p
% Plot Step response
step(syscl), hold on
% Compare with the reference 2nd-order Transfer function
s = tf('s');
Gref = 202.833/(s^2 + 15.8*s + 202.833)
step(Gref, 1), grid on, hold off
legend('Closed-loop system', '2nd-order system')
0 个评论
Sam Chak
2023-11-26
Based on the description from the OP, the compensated system should form a closed-loop system. The formula for a closed-loop transfer function, when the compensator is placed in series with the plant (ys), is given by:
% closed-loop transfer function (CLTF):
% compensated_sys = (compensator*ys)/(1 + compensator*ys) % actual G/(1 + G)
% desired_sys = (compensator*ys)/(1 + compensator*ys) % desired G/(1 + G)
The OP aims to design the compensator in a way that two of the closed-loop poles are (-7.9 ± 11.85i). When these poles are plotted on the root locus diagram, the locus should traverse the two desired closed-loop poles.
s = tf('s');
ys = tf(0.03965, [5.28e-08, 1.856e-05, 0.00080187, 0])
% Desired system (closed-loop) to maintain unity (1) when s = 1
desired_sys = ((-7.9 - 11.85i)*(-7.9 + 11.85i))/((s - (-7.9 - 11.85i)) * (s - (-7.9 + 11.85i)))
% Compensator (improper, numerator's degree > denominator's degree
% The compensator can be inversely obtained by solving the CLTF equation
compensator = desired_sys/(ys - ys*desired_sys)
% Closed-loop system
compensated_sys = feedback(compensator*ys, 1); % can use feedback() command for CLTF
compensated_sys = minreal(compensated_sys)
The poles (or roots of the denominator) of the compensated system can be checked using this command:
% Check closed-loop poles
CL_poles = pole(compensated_sys)
% Plot the step response of Compensated system and compare with Desired system
figure(1)
step(compensated_sys, 1), hold on
step(desired_sys, 1), grid on, hold off
legend('Compensated system', 'Desired system')
% Plot Root locus
figure(2)
rlocus(compensator*ys), hold on
plot(-7.9, 11.85, 'rx', 'markersize', 12, 'linewidth', 3)
plot(-7.9, -11.85, 'rx', 'markersize', 12, 'linewidth', 3)
axis([-10 -6 -20 20]), hold off
While this method can make the root loci pass through the desired closed-loop poles, the compensator will consequently be improper. Note that the closed-loop poles of the compensated system have six additional poles.
3 个评论
Sam Chak
2023-11-28
Yup, @Arpad. The Angle Deficiency Compensation method is commonly taught in the Root Locus to determine the locations of the compensator's zero(s) and pole(s). As shown in yours and @Paul's calculations, introducing the compensator's pole at
should make the root locus pass through the desired closed-loop poles (see Figure 1). You will also need to make a gain adjustment to move the closed-loop poles to the desired locations (
). However, this method only approximates the desired 2nd-order system (see Figure 2), due to the presence of nearby closed-loop poles. But I think the result is acceptable to your Professor.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1554032/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1554037/image.png)
Previously, I thought your professor wanted you to drive the closed-loop system to behave "exactly" like the reduced 2nd-order system with two poles at
, producing the desired overshoot and settling time. That's why I introduced the Dominant Closed-loop Poles concept in which you can freely assign the 3rd desired closed-loop negative real pole that is far far away from the dominant closed-loop poles (
).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1554042/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1554047/image.png)
figure(1)
figure(2)
Sam Chak
2023-11-28
Hi @Arpad
By the way, these techniques of placing the closed-loop poles in the desired locations fall under the Pole Placement method. I also forgot to mention that the solution to your problem is not unique because there are infinitely many solutions. You can present alternative solutions to your Professor and ask for opinions (considering the pros and cons of each technique).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Classical Control Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!