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

조회 수: 3 (최근 30일)
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.

채택된 답변

Cyrus
Cyrus 2018년 11월 4일
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
Star Strider
Star Strider 2018년 11월 4일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Cyrus
Cyrus 2018년 11월 4일
편집: Cyrus 2018년 11월 4일
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 2018년 11월 4일
편집: Cyrus 2018년 11월 4일
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');

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by