필터 지우기
필터 지우기

How to access the maximum value of the radius in rose?

조회 수: 2 (최근 30일)
Ali Y.
Ali Y. 2017년 3월 8일
댓글: Star Strider 2017년 3월 14일
Could someone help me to access to the value of the radius automatically plotted in any rose diagram? I have to say that I use Matlab 14b. Say, having the following code, how can I get the value 40?
load sunspot.dat
theta = sunspot(:,2);
figure (222)
rose(theta,12)

채택된 답변

Star Strider
Star Strider 2017년 3월 8일
Ask rose for two outputs. You can then plot it with polar.
The Code
load sunspot.dat
theta = sunspot(:,2);
[t_out, r_out] = rose(theta,12);
[r_max, idx] = max(r_out) % Maximum Radius & Index
t_max = t_out(idx)*180/pi % Corresponding Angle
figure (222)
polar(t_out, r_out)
r_max =
38
idx =
30
t_max =
210
  댓글 수: 4
Ali Y.
Ali Y. 2017년 3월 14일
Thank you so much for your help. I works fine.
Although, I have to mention that I had to break the last line of the code, since it seems Matlab (version 14b) does not support 'field of structure' in this case. Because, executing the line
hr.Parent.XLim
gives the error "Attempt to reference field of non-structure array". So, I got the result of this line in two steps; like:
hr = rose(theta,12);
hrp = get(hr,'parent')
rxlim = get(hrp,'XLim')
Star Strider
Star Strider 2017년 3월 14일
My pleasure.
The get function will work regardless of the version you are using. I thought R2014b (that introduced the new ‘Handle Graphics 2’) also introduced the structure syntax. My apologies.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by