I have frequency responses of FIR filter of order 13 from obtained 50 frequency samples. How can I get FIR filter coefficients of order 13?

For example, in MATLAB a lot of possible ways I tried ;

I have a frequency samples : w=[0 1] (1x50)

I have frequency responses of FIR filter of order 13: hd (1x50)

b1=fir1(12,wc) % b1:FIR filter ideal coefficients of order 13

hd=freqz(b1,1,w) %hd :FIR filter frequency responses with respect to b1
  1. When I apply inverse fourier transform to FIR filter frequency responses ( ifft(hd,13) ), I don't reach b1. I am supposed to reach b1 coefficients in theory. Am I right?
  2. I apply inverse fft shift for moving to true domain before apply Fourier Transform( ifft( ifftshift(hdg),13) ) but also I don't reach b1. So what else can I do?

There is incompatible things(may be between frequencies and transforms ) I don't understand.


The frequency argument for freqz() should be in radians/second, not normalized frequency in [0,1). It has a form that makes it easy for you:

% length of frequency response vector
N = 50;
% cutoff frequency
wc = 0.25;
% design 12th-order lowpass filter
b1 = fir1(12, wc);
% calculate its frequency response at `N` points around unit circle
hd = freqz(b1, 1, N, 'whole');
% inverse transform the frequency response
b2 = ifft(hd);
% `b1` and `b2` should be the same.
plot(1:length(b1), b1, 1:length(b2), b2);

This yields the plot:

enter image description here

You only see one trace because they are right on top of one another, as they should be. b2 is longer in duration because it has the same length as the frequency response vector, which was arbitrarily chosen to have length 50.

  • $\begingroup$ So do you have any idea how to convert normalized frequencies (w) to radians/second ? $\endgroup$ – yigit Apr 21 '15 at 15:05
  • $\begingroup$ Multiply by $\pi$. You'll need to cover the full range from $0$ to $2\pi$ in order to get the result shown above. fir1 only deals in real filters, so its cutoff frequency is always between $0$ and $\pi$ radians/second. $\endgroup$ – Jason R Apr 21 '15 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.