How to add a line to a freqz plot?

6 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by