Why does the magnitude response of freqz change with the value of the input argument n?

2 visualizaciones (últimos 30 días)
I am using the freqz command, and the second argument, n, is documented as N-point frequency response. Therefore, I take it to mean that as n gets larger, the resolution of the frequency response should get finer and more smooth. But when I run this command, this is not what happens. Instead, I see the magnitude values changing. This makes no sense, and the documentation is quite poor.

Respuesta aceptada

Cyrus
Cyrus el 4 de Nov. de 2018
OH OH OHHHH, I think I found the problem. it should be the third input argument. When I had it as the second, it was changing the actual FIR filter itself!
freqz(B,1,n)
  2 comentarios
Star Strider
Star Strider el 4 de Nov. de 2018
Please note: you did not ever post the code you used in your freqz call.
Our ability to read minds is in general severely lacking.

Iniciar sesión para comentar.

Más respuestas (2)

Cyrus
Cyrus el 4 de Nov. de 2018
Editada: Cyrus el 4 de Nov. de 2018
To be more clear, when I run freqz(B) the amplitude is nearly 1 until the cutoff, and then falls off to zero - as it should. It's a low pass filter of order 80 using fir1.
When I do freqz(B,2000), the amplitude from zero to the cutoff is now no where near 1, its down to 0.00003. This makes no sense.

Cyrus
Cyrus el 4 de Nov. de 2018
Editada: Cyrus el 4 de Nov. de 2018
Run this code and change freqz(B) to instead say freqz(B,2000) and see what happens:
rps2Hz = 1/(2*pi);
fs = 1000;
M = 15;
fpass = 0:0.1:fs/(2*M);
frej = fs/(2*M):0.1:fs/2;
order = 80;
wn = 1/M;
B = fir1(order,wn,hamming(order+1));
[h,w] = freqz(B);
figure(2);
plot(fs*w*rps2Hz,abs(h),'linewidth',2.0);
xlabel('freq (Hz)');
ylabel('Amplitude');

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by