Axis labels in root locus

51 次查看(过去 30 天)
Anna
Anna 2014-8-20
评论: Anna 2014-8-21
When I plot root locus, both axis labels contain units in brackets; what I get is the following: x axis: Real Axis (seconds-1) y axis: Imaginary Axis (seconds-1)
I'd like to have, instead, only the notation "Real Axis" respectively "Imaginary Axis". How can I remove "(seconds-1)"?

采纳的回答

Aniruddha Katre
Aniruddha Katre 2014-8-20
The plot generated by "rlocus" has two sets of axes, one hidden and one visible. The labels that you see are linked to the hidden axes. Therefore, when you use "xlabel" or "ylabel", the changes aren't implemented completely and you can still see the "seconds^-1" in the labels. In order to rename the labels according to your liking, you can use the following set of commands.
axIm = findall(gcf,'String','Imaginary Axis (seconds^{-1})');
axRe = findall(gcf,'String','Real Axis (seconds^{-1})');
set(axIm,'String','Imaginary Axis');
set(axRe,'String','Real Axis');
The call to the "findall" command finds the exact handle of the axes labels that you want to change by searching for the "String" property that is set to the current axes labels. If you want to change the axes labels to some other string, you can then execute the "set" command.
  1. Doc to findall
  2. Doc to set
  1 个评论
Anna
Anna 2014-8-21
Great, it worked! Thanks also for the explanation, finally I understand why the xlabel command doesn't work. Thanks really a lot!

请先登录,再进行评论。

更多回答(1 个)

William Frane
William Frane 2014-8-20
编辑:William Frane 2014-8-20
If you haven't already, try the xlabel() and ylabel() functions (they work for me).
For example:
h = tf([1 2 3],[4 5 6]);
rlocus(h);
xlabel('New x-axis label');
EDIT: This only works when using older versions of MATLAB (I initially tested it on R2008a). On newer versions (e.g., R2011b), xlabel() and ylabel() won't work and Aniruddha's solution must be used.

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by