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 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