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

조회 수: 99 (최근 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