How can you turn on 'All Stability Margins' when using the 'bode' function via script?

15 ビュー (過去 30 日間)
Jason
Jason 2014 年 6 月 19 日
編集済み: Erick Oberstar 2022 年 4 月 17 日
Instead of right clicking on the bode plot and selecting Characteristics -> Minimum Stability Margins, how can I do this automatically via scripting? I don't want to manually do it. (Matlab 2012b)

回答 (2 件)

Arkadiy Turevskiy
Arkadiy Turevskiy 2014 年 7 月 11 日
You can use function margin:
sys=tf(1,[1 1 0]);
margin(sys)

Erick Oberstar
Erick Oberstar 2022 年 4 月 17 日
編集済み: Erick Oberstar 2022 年 4 月 17 日
As of Matlab 2020b I can verify this works for both nyqistplot and bodeplot functions
Ts= 0.01
n = [0 0.3680 0.2640];
d = [1.0 -1.368 0.3680];
Gz = tf(n,d,Ts)
Gz.Variable = 'z^-1'
figure; h1=nyquistplot(Gz)
axis([-1.5 1.5 -1.5 1.5]); grid on;
h1.showCharacteristic('AllStabilityMargins');
%zoomcp(h1);% Optional zoom in on critical point
figure; h2 = bodeplot(Gz)
h2.showCharacteristic('AllStabilityMargins');
Note this doesn't work if you generate the plots via "bode" or "nyquist"

Community Treasure Hunt

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

Start Hunting!

Translated by