Axis labels in root locus

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