How to find the intersection a root locus plot and a line with specific angle?

97 次查看(过去 30 天)
For example when I use the following code to plot root locus:
s=tf('s');
GH=(1)/(s*(s+1)^2);
rlocus(GH)
the output is:
But i'm interested in the intercection between a 60 degree line and the plot, the wanted output is the following:
I'm interested in the value of K.

采纳的回答

Adam Danz
Adam Danz 2021-8-27
There may be an analytical approach that would be better than this approach but one way to do it is to get the handle of the blue line (assuming there is only 1 blue line in the axes and the line is truely blue, [0 0 1]) and to compute the intersection of that line and the line defined by your angle from (0,0). This uses intersections.m from the file exchange.
clf
s=tf('s');
GH=(1)/(s*(s+1)^2);
rlocus(GH)
% Get handle to blue line
ax = gca();
curveLine = findobj(ax, 'Type','Line','Color', 'b', 'Marker','none');
% Find intersection of the angle from x-axis at
% origin (0,0)
ang = 60; % deg from negative x-axis into quadrant 3
xLine = [0, ax.XLim(1)];
yLine = [0, tand(-ang)*xLine(2)];
[x0,y0,~,~] = intersections(curveLine.XData, curveLine.YData, xLine, yLine);
% Plot the lines and intersection
hold(ax,'on')
plot(ax, curveLine.XData, curveLine.YData, 'k--', 'LineWidth', 2)
plot(ax, xLine, yLine, 'k--', 'LineWidth', 2)
% remove (0,0) intersection and label intersection
isNot0 = x0~=0 & y0~=0;
plot(ax, x0(isNot0), y0(isNot0), 'mo','MarkerSize', 12)
text(ax, x0(isNot0)*2, y0(isNot0), ...
sprintf('%.1f%s (%.3f, %.3f)',ang,char(186),x0(isNot0), y0(isNot0)), ...
'HorizontalAlignment', 'right')
  2 个评论
Luke McDevitt
Luke McDevitt 2023-4-26
编辑:Luke McDevitt 2023-4-26
Does the script only work with 2nd order systems? I can't seem to edit it in a way that allows for it to find the intersection for the system: GH=(s+8)/((s+6)*(s+3)*(s+10));
dashed line is between -8 and -10 on the real axis and not on the part of the rlocus that varies over the imaginary axis
The correct answer for an angle: -62.87 is
-5.415+-j10.57
EDIT: realized it just goes after the blue line, but changing the color to 'g' also does not work correctly, even if I flip the angle to a -27.13 to get the lines to intersect the script does not produce the desired result

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Classical Control Design 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by