bodeplot(), setoptions - YLabel, How to set?

9 ビュー (過去 30 日間)
cdlapoin
cdlapoin 2022 年 2 月 15 日
コメント済み: cdlapoin 2022 年 2 月 15 日
I have a bodeplot and want to change the Ylabel text from Magnitude to something more descriptive
h = bodeplot(sys,w);
setoptions(h,'YLabel','MyString');
doesn't work, so I look at it with getoptions()
>> getoptions(h,'Ylabel')
ans =
struct with fields:
String: {'Magnitude' 'Phase'}
FontSize: 11
FontWeight: 'normal'
FontAngle: 'normal'
Color: [0 0 0]
Interpreter: 'tex'
So it is a struct, but I cannot figure out how to address it properly with the way setoptions() is formatted. I tried:
setoptions(h,'YLabel(1).String','MyString')
which doesn't work or any of the other obvious variations. so now it's bothering me. Please help!

採用された回答

Voss
Voss 2022 年 2 月 15 日
編集済み: Voss 2022 年 2 月 15 日
rng("default")
sys = rss(5);
h = bodeplot(sys);
ylabel_opts = getoptions(h,'YLabel')
ylabel_opts = struct with fields:
String: {'Magnitude' 'Phase'} FontSize: 11 FontWeight: 'normal' FontAngle: 'normal' Color: [0 0 0] Interpreter: 'tex'
% set only the magnitude plot ylabel string (leave phase alone):
ylabel_opts.String{1} = 'MyString';
% apply the new settings:
setoptions(h,'YLabel',ylabel_opts);
  1 件のコメント
cdlapoin
cdlapoin 2022 年 2 月 15 日
so the correct answer is to build a complete YLabel struct, then replace the existing on with setoptions(). perfect! Thanks!

サインインしてコメントする。

その他の回答 (1 件)

Paul
Paul 2022 年 2 月 15 日
opts = bodeoptions;
opts.Ylabel.String = {'mymag' 'myphase'};
bodeplot(tf(1,[1 1]),opts)

カテゴリ

Help Center および File ExchangePlot Customization についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by