フィルターのクリア

Cannot plot negative frequencies on Nichols with recent MATLAB versions

2 ビュー (過去 30 日間)
lepolonais03
lepolonais03 2023 年 12 月 15 日
編集済み: Paul 2023 年 12 月 16 日
Hello all, I'm having trouble plotting negative frequencies of nichols plot on my newest MATLAB version. I try specifying Nichols(sys,w) with w=[-100:0.1:-0.1 0.1:0.1:100] and it plots the expected figure with 2017a Matlab version but not with 2021b version and i cannot figure out why

採用された回答

Paul
Paul 2023 年 12 月 15 日
編集済み: Paul 2023 年 12 月 15 日
Hi lepolonais03.
Test case shows that only positive frequencies are considered, as you've obeserved.
sys = zpk(1,[2 3],4);
w=[-100:0.1:-0.1 0.1:0.1:100];
figure
nichols(sys,w)
That is odd, becasue the doc explicitly states that for this syntax:
"The vector w can contain both negative and positive frequencies."
As a workaround, you can use the output form of nichols and make the plot yourself
[mag,phase,wout] = nichols(sys,w);
figure
plot(squeeze(phase),squeeze(db(mag)))
Also, investigate nicholsplot, which might give an option to construct the plot to include negative frequencies.
Seems like bode is also not plotting in accordance with the doc.
figure
bode(sys,w)
  2 件のコメント
lepolonais03
lepolonais03 2023 年 12 月 16 日
Thank you for the solution! It seems to be all right. But yeah that's odd that the plot, even if written in the doc, does not work on recent versions!
Paul
Paul 2023 年 12 月 16 日
編集済み: Paul 2023 年 12 月 16 日
It's interesting that it worked the way you say in 2017b. The online doc only goes back as far as 2018b, and in 2018b the doc page nichols 2018b does NOT explicitly say that w can have negative values. Reviewing the release notes it seems like the intent of the negative frequencies option is only to support models with complex coefficients (if that's the case, the doc page should say that explicitly).
So another workaround, which is kind of janky, would be
sys = zpk(1,[2 3],4);
format long e
[z,p,k] = zpkdata(sys);
systemp = zpk(z{:},p{:},k + 1j*eps(k))
Warning: This zpk model has a complex gain or some complex zeros or poles that do not come in conjugate pairs.
systemp = (4+8.8818e-16i) (s-1) --------------------- (s-2) (s-3) Continuous-time zero/pole/gain model.
w=[-100:0.1:-0.1 0.1:0.1:100];
figure
nichols(systemp,w)

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

その他の回答 (0 件)

カテゴリ

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