Axis labels in root locus

43 views (last 30 days)
Anna
Anna on 20 Aug 2014
Commented: Anna on 21 Aug 2014
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)"?

Accepted Answer

Aniruddha Katre
Aniruddha Katre on 20 Aug 2014
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 Comment
Anna
Anna on 21 Aug 2014
Great, it worked! Thanks also for the explanation, finally I understand why the xlabel command doesn't work. Thanks really a lot!

Sign in to comment.

More Answers (1)

William Frane
William Frane on 20 Aug 2014
Edited: William Frane on 20 Aug 2014
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.

Products

Community Treasure Hunt

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

Start Hunting!