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

4 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Cyrus
Cyrus le 4 Nov 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 commentaires
Star Strider
Star Strider le 4 Nov 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.

Connectez-vous pour commenter.

Plus de réponses (2)

Cyrus
Cyrus le 4 Nov 2018
Modifié(e) : Cyrus le 4 Nov 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 le 4 Nov 2018
Modifié(e) : Cyrus le 4 Nov 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');

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by