フィルターのクリア

Add reference line to a Bode Plot

46 ビュー (過去 30 日間)
Leandro  Cavalheiro
Leandro Cavalheiro 2017 年 12 月 21 日
コメント済み: am 2021 年 2 月 25 日
Greetings!
I used the command
h = bodeplot(Gol,{0.1 0.5});
to plot Bode diagrams (Magnitude x Frequency and Phase Angle x Frequency) to analyze the stability of the closed-loop system. Hence, I need to draw a horizontal reference line at y = 1 on the first graph (Mag. x Freq.) so as to find out if my system stable or not.
How do I do that? Were it a simple plot, I'd use refline but it doesn't work for the bodeplot function, since it generates two plots (like subplot(2,1,1) and subplot(2,1,2)). Thank you.

採用された回答

Star Strider
Star Strider 2017 年 12 月 21 日
It is not worthwhile to attempt to do anything with the plots that bode and most — if not all — of the other Control System Toolbox plots. They do not allow modifications.
Instead, get the outputs from the bode function:
[mag,phase,wout] = bode(sys);
and plot them using subplot. Remember to use the squeeze command to remove singleton dimensions from the ‘mag’ and ‘phase’ results for simple models.
  2 件のコメント
Leandro  Cavalheiro
Leandro Cavalheiro 2017 年 12 月 23 日
Thanks. I'll try that.
Star Strider
Star Strider 2017 年 12 月 24 日
It will work.
Remember to use semilogx for the subplots, and 20*log10(mag) for the y-axis of the magnitude plot.

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

その他の回答 (1 件)

Rick Giovanini
Rick Giovanini 2018 年 3 月 28 日
編集済み: Rick Giovanini 2018 年 3 月 28 日
check this out. Bodes want LTI - Linear Time invariant objects. You can plot many bode's on one plot if you have many LTI objects. What's the LTI transfer function of a horizontal line? Well it's simply
k*tf([1],[1]), where k is the y value I desire. In other works, k*(1/1), or k. We know it's just k that we want, but matlab wants a transfer function.
so, if I want my bode with some horizontal lines, simply do...
bode(mybode, yourbode, NowIfWe_reTalkingBodes_YouGotAPerfectOneSoPutItOnMe, k*tf([1],[1]), r*tf([1],[1]), s*tf([1],[1]))
which simply produces some bodes and lines at y=k, r, and s.
First ever post. Like if it helps you.
  2 件のコメント
Mirza  Sajjad Hussain
Mirza Sajjad Hussain 2019 年 3 月 14 日
very thanks
am
am 2021 年 2 月 25 日
Lol @Rick Giovanini, thanks it helped!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by