How to add a line to a freqz plot?

6 ビュー (過去 30 日間)
Sherman Lim
Sherman Lim 2021 年 10 月 5 日
回答済み: Star Strider 2021 年 10 月 5 日
Hi all,
I need to add a line of y = 0 across my freqz plot for my project. What command do I need to include my script?
My script:
Fp = 1000; %Bandpass Freq
Fs = 2000; %BandStop Freq
SF = 10000; %Sampling Freq
Pr = 0.1; %Passband ripple
Sr = 0.001; %Stopband ripple
[n,fo,ao,w] = firpmord([Fp Fs],[1 0],[Pr Sr],SF);
b = firpm(n,fo,ao,w);
freqz(b,1)
Thanks in advance.

採用された回答

Star Strider
Star Strider 2021 年 10 月 5 日
Since freqz plots are ordinary subplots, just address them as such —
Fp = 1000; %Bandpass Freq
Fs = 2000; %BandStop Freq
SF = 10000; %Sampling Freq
Pr = 0.1; %Passband ripple
Sr = 0.001; %Stopband ripple
[n,fo,ao,w] = firpmord([Fp Fs],[1 0],[Pr Sr],SF);
b = firpm(n,fo,ao,w);
figure
freqz(b,1)
Ax1 = subplot(2,1,1);
yline(Ax1, 0, '-r', 'LineWidth',2)
The horizontal line at y=1 is going to be a bit difficult to see, so I emphasized it. Change the yline call appropriately if necessary to change its appearance.
.

その他の回答 (1 件)

Kevin Holly
Kevin Holly 2021 年 10 月 5 日

カテゴリ

Help Center および File ExchangeDigital Filter Analysis についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by