freqz vs FFT question

Started by rudy...@yahoo.com April 15, 2013
I have always been confused about this two functions. Can someone please clarify why they behave this way? Let me give an example

To me it looks like that if we compute the impulse response of a filter, it should be the same thing as taking the FFT of that filter.
But how come there is a difference?

For example, let's say if I take the simple FFT of the following hamming window:

w = hamming(L);
Fs = 1000;
NFFT = 1024;
W = fft(w,NFFT);
f = Fs/2*linspace(0,1,NFFT/2+1);
This makes perfect sense, because when I take the fft of the hamming window, I am expecting an even function in frequncy, and by plotting the above we are essentially looking at the half of the spectrum [0:Fs/2].
Which on a normalized plot, this means that we are looking at the range [0:0.5]

However, when we go with freqz:

[W2 f2]=freqz(w);
magdb = 20*log10(abs(W2));

we have on x-axis from [0:3.14].
But, I would have expected this to go only half way [0:pi/2]

Then those two results (fft and freqz) would've been identical.

However, other matlab tools that uses freqz (e.g. wvtool), they always show the x-axis from [0:1], which I don't understand why?

For example, using this:


I would've expect to see the frequency response plot's x-axis to show [0:0.5] instead of [0:1], because going [0:1], we are going full circle, which would've suggested for the frequency response being even (e.g. seeing the mirror of what we are seeing toward the x-axis close to 1). Just like when we take the fft(w) !!!

Because now freqz and fft will be off by a factor of 2 on the x-axis !!!