Show value on the root locus plot without using the Data Cursor

106 ビュー (過去 30 日間)
MatlabNewbie01232015
MatlabNewbie01232015 2013 年 10 月 11 日
コメント済み: Prakhar Goel 2020 年 5 月 26 日
There are a large number of examples how to plot the root locus - using the rlocus function. The gain K can be showed from the graph with the Data Cursor. Is there anyway to show this value without using the Data Cursor but Matlab Code.
For example, I want to show Poles, Damping, Overshoot%, Frequency if K = 10 on the plot using Matlab code?
Thanks

採用された回答

Jonathan LeSage
Jonathan LeSage 2013 年 10 月 15 日
The rlocus function can output the complex root locations and the corresponding gains. You can manually plot these values to replicate the plot generated by rlocus and then plot particular points of interest, such as the complex roots when K = 10.
You can also use the stepinfo function to acquire additional information, such as percent overshoot, to display. Using a method of this variety allows you to have full control over what you are displaying on your root locus plot!
Here is some code to get you started, and to introduce you to useful functions:
% Specify an arbitrary transfer function
G = tf([1 2],[1 4 13]);
% Pick gain to mark on root locus
gainToMark = 5;
% The rlocus function can output the values normally plotted and the gains
% associated with each value on the complex plane
[complexVec,gainsVec] = rlocus(G);
% Recall: the root locus is displayed on the complex plane (s = \sigma +
% j*\omega)
realPart = real(complexVec);
imagPart = imag(complexVec);
% First closed loop pole with increasing gain, K
realCLpole1 = realPart(1,:);
imagCLpole1 = imagPart(1,:);
% Second closed loop pole with increasing gain, K
realCLpole2 = realPart(2,:);
imagCLpole2 = imagPart(2,:);
% Plot the closed loop poles as varying with gain K
plot(realCLpole1,imagCLpole1,realCLpole2,imagCLpole2);
hold on;
ylabel('Imaginary Axis');
xlabel('Real Axis');
% Plot open loop poles
plot(realCLpole1(1),imagCLpole1(1),'bx'); hold on;
plot(realCLpole2(1),imagCLpole2(1),'bx');
% Plot open loop zeros
plot(realCLpole1(end),imagCLpole1(end),'bo'); hold on;
plot(realCLpole2(end),imagCLpole2(end),'bo');
% Find the the location of the gain of interest on the root locus
indexOfGain = find(gainsVec >= gainToMark,1,'first');
markedGain = gainsVec(indexOfGain);
% Form the closed-loop feedback system with selected gain
CLsystem = feedback(G,markedGain);
% Acquire step response values of interest from the closed-loop system
stepResponse = stepinfo(CLsystem);
percentOvershoot = stepResponse.Overshoot;
% Plot test box with results onto plot
gainString = ['Gain: ' num2str(markedGain)];
osString = ['%OS: ' num2str(percentOvershoot) ' %'];
text(-2.25,1.5,gainString);
text(-2.25,1.0,osString)
% Plot closed-loop poles arising from feedback gain selection
plot(realCLpole1(indexOfGain),imagCLpole1(indexOfGain),'r+');
plot(realCLpole2(indexOfGain),imagCLpole2(indexOfGain),'r+');
xlim([-10 2]); ylim([-4 4]);
Hope this helps!
  2 件のコメント
MatlabNewbie01232015
MatlabNewbie01232015 2013 年 10 月 15 日
Thank you very much!
Prakhar Goel
Prakhar Goel 2020 年 5 月 26 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeClassical Control Design についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by