Problem when graphing digital filter chebyshev
Mostrar comentarios más antiguos
Hello, I need to design a chebyshev digital filter, with cutoff frequencies of 250 and 2000 Hz, it should cut at 0.7 at these two frequencies. The code I am using does not meet the objectives, it is the following:
Fs = 44000;
Fn = Fs/2;
n = 3; Rp = 0.5;
Wn = [250 2000]/Fn;
[b a]=cheby1(n,Rp,Wn,'bandpass')
[h,w]=freqz(b,a)
plot(w,abs(h))
What I need to graph is what is shown in the image. The order is 3 and the ripple is 0.5

Respuestas (1)
Need some some addition arguments to freqz(). Check its doc page for more information:
Fs = 44000;
Fn = Fs/2;
n = 3; Rp = 0.5;
Wn = [250 2000]/Fn;
[b a]=cheby1(n,Rp,Wn,'bandpass');
[h,f]=freqz(b,a,1024,Fs);
semilogx(f,abs(h))
Adjust n and Rp for the desired result.
8 comentarios
Juan Chehin
el 30 de Ag. de 2021
That code again returns an incorrect graph. For example at 250 Hz it shows 0.9441

Paul
el 30 de Ag. de 2021
As I said, you'll need to adjust the n and Rp inputs to cheby1 to match that plot. Also, if you increase n, consider chaning the 1024 in the call to freqz to something bigger, like 4096.
Juan Chehin
el 1 de Sept. de 2021
n and Rp are fixed. That is, n = 3 and Rp = 0.5 are the requirements
Paul
el 1 de Sept. de 2021
In that case, you can't get the graph in the figure, at least not using cheby1.
Juan Chehin
el 1 de Sept. de 2021
Sorry, the filter order n is 6
Paul
el 1 de Sept. de 2021
Did you try the code at the top of this answer with n=6? Does it yield the desired result?
Juan Chehin
el 1 de Sept. de 2021
Yes, but with some modifications
Fs=4400;
Fn = Fs/2;
n = 6;Rp = 0.5;
[b,a]=cheby1(n,Rp,[250/Fn,2000/Fn]);
[h,f]=freqz(b,a,1024,Fs);
plot(f,abs(h));
xlabel('Frequency (Hz)')
Paul
el 1 de Sept. de 2021
Do you now have the desired result or is there still an open question? Did you intentionally reduce Fs from 44000 to 4400?
Categorías
Más información sobre Chebyshev en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
