In R2024b how to read the Y tick labels of a bode plot

조회 수: 8 (최근 30일)
Harm
Harm 2025년 3월 7일
댓글: Sulaymon Eshkabilov 2025년 3월 7일
In matlab 2024b how do I read the Y tick labels of a bode plot? Here is an example script that works in R2022b
sys = rss(1);
figure;
bode(sys)
axis = gca;
points = get( axis , 'Ytick' );
Which gives the result
points =
-15 -10 -5 0
But in R2024b it gives the error Unrecognized property Ytick for class controllib.chart.BodePlot.
Any ideas how to do this in this version?

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 3월 7일
Here is the corrected code:
% TF of the given system:
sys = rss(1);
% BODE Plot:
H=bodeplot(sys); % Generate Bode plot and get handle
% Get MAG and PHASE axes handles:
AX = findall(gcf, 'Type', 'axes');
% Extract Y-tick LABELS:
MAG_yticks = yticks(AX(1)); % MAGNITUDE plot
MAG_yticklabels = yticklabels(AX(1));
PHASE_yticks = yticks(AX(2)); % PHASE plot
PHASE_yticklabels = yticklabels(AX(2));
% Display the RESULTS:
disp('MAG Y-tick Labels:');
MAG Y-tick Labels:
disp(MAG_yticklabels);
{'-6'} {'-5'} {'-4'} {'-3'}
disp('PHASE Y-tick Labels:');
PHASE Y-tick Labels:
disp(PHASE_yticklabels);
{'0' } {'45' } {'90' } {'135'} {'180'}
  댓글 수: 2
Harm
Harm 2025년 3월 7일
Thank you, this is what I need. It also works with bodemag and bode.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 3월 7일
Glad to help. Good luck!

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by