Azzera filtri
Azzera filtri

Finding intersection of rlocus branch and a line at an angle

14 visualizzazioni (ultimi 30 giorni)
Modified code to suit my use case:
clf
s=tf('s');
GH=(s+8)/((s+6)*(s+3)*(s+10));
rlocus(GH)
% Get handle to red line
ax = gca();
curveLine = findobj(ax, 'Type','Line','Color', 'r', 'Marker','none');
% Find intersection of the angle from x-axis at
% origin (0,0)
ang = -62.87; % 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('(%.3f, %.3f)',x0(isNot0), y0(isNot0)), ...
'HorizontalAlignment', 'right')
Expected results:
The correct answer for an angle: +-62.87 is
-5.415+-j10.57
The issue that I am getting is the code outputs 2 different sets of intersections instead of 1 x,y group. I suspect that this is because it has a "phantom" intersection.
Answer I got (-5.415, -2.750)(-10.569, -11.710)
Expected (-5.415, -10.569)
Bonus points for outputting K :p

Risposte (1)

Paul
Paul il 26 Apr 2023
One way would be to use the output arguments from rlocus to get the closed loop pole locations and the associated gain.
Here's the root locus plot.
s=tf('s');
GH=(s+8)/((s+6)*(s+3)*(s+10));
rlocus(GH),sgrid
Get closed loop pole locations and associated gains.
[r,k] = rlocus(GH);
Compute the angles from the -x-axis of the pole locations.
angles = 180/pi*atan2(imag(r),-real(r));
At this point, I'll leave the rest to you to figure out the value of the gain k that corresponds to the desired angle. A couple of things to keep in mind. Some problems might have no value of k that satisfies the criteria and others might have more than one, so you'll have to consider all possbilities. The other is that rlocus does not gurantee (at least I don't think it does) that each column of r is a continous branch of the root locus (though I do think rlocus tries very hard to make that so). So there's a possbility that two or more columns of r can jump from one branch to another, and if that happens at the critical point where the angle is what you're looking for there will be complications.

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by