How can I change the units of a plot function in the plot tab?

조회 수: 121 (최근 30일)
onamaewa
onamaewa 2019년 4월 1일
편집: Adam Danz 2019년 4월 1일
This plot was generated by pwelch(variable); figure(variable).
It's a predefined plot in the Plot tab. I need to multiply the X-axis by 5000 and change the displayed units.
How can I do this?

채택된 답변

Adam Danz
Adam Danz 2019년 4월 1일
편집: Adam Danz 2019년 4월 1일
After producing the plot,
h = gca;
h.XTickMode = 'manual';
h.XTickLabel = h.XTick * 5000;
h.XLabel.String = 'Frequency (x \pi rad/sample)';
Note that this changes the tick labels, not the ticks themselves. So if you're setting axis limits, you'll continue working with the normalized units 0:1.
  댓글 수: 2
onamaewa
onamaewa 2019년 4월 1일
편집: onamaewa 2019년 4월 1일
This works! Thank you!
For future edits of this plot such as Figure Naming, axis limiting, etc, where can I find what you did in the Documentation?
Adam Danz
Adam Danz 2019년 4월 1일
편집: Adam Danz 2019년 4월 1일
All I did was to grab the axis handle. With that handle you can edit all sorts of properties;
To set axis limits
h.XLim = [0,1];
h.YLim = [-180, -110];
To name the figure you'll need the figure handle
figHandle = gcf;
figHandle.Name = 'myFigure';

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by