# FFTW - Inverse FFT input data

I am trying to use FFTW function for IFFT:

fftw_plan_dft_c2r_1d(size, out_cpx, out, FFTW_ESTIMATE).


My goal is to input desired frequency response data and obtain related coefficients using Inverse Fourier Transform. Since out_cpx is complex, I calculated magnitude (0,1) and phase, taking into account it is linear phase filter. Since I know the phase I calculated real and imaginary parts as Acos(w) and Asin(w) and with these pairs I populated out_cpx[i][0] and out_cpx[i][1]. When I perform Inverse Fourier Transform using fftw_plan_dft_c2r_1d() I assume I am right away getting FIR coefficients h[n] as the result. With these coefficients i go to MATLAB and get response using freqz(C,1) where C holds my coefficients. But I am getting a lot of ripples in my graph for response and for phase. Am I doing something wrong here? It is not clear to me how to specify phase of the desired frequency response.

• This probably isn't how you want to design a filter. There are numerous better methods for doing so; just Google "digital filter design." May 15, 2015 at 13:16
• I have already Googled and already got some answers here that point this way. How else would you design FIR filter given specification 6dB @ 1.6kHz and slope 24 dB/octave? One way is to use design IIR Butterworth filter and use its coefficients for FIR. The other is sampled frequency method where you input desired frequency response and get its IFT which gives you coefficients. May 15, 2015 at 13:25