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.
0 个评论
采纳的回答
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.
.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!