How to add a line to a freqz plot?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sherman Lim
am 5 Okt. 2021
Beantwortet: Star Strider
am 5 Okt. 2021
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 Kommentare
Akzeptierte Antwort
Star Strider
am 5 Okt. 2021
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 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!