0
votes

I'm new to DSP. I'm trying to create application for educational purposes on java. I want to compute FIR filter coefficients and plot it's frequency response.

To compute coefficients I want to use ifft of ideal frequency response, which is basically rectangular window. I can compute coefficients with this method and my FIR filtering signals. Then I want to explore it's frequency response. As I know I can get it from impulse response of filter through fft (But then it would be the same rectangular window, right?). And I get the same rectangular ideal frequency response, but I want real frequency response. Like in that picture.

enter image description here

How can I do that?

2

2 Answers

0
votes

remember the using fft or ifft you are assuming that your signal is periodic (so its not one rectangle, its infinite ones). Also, the ideal response is a rectangular window in amplitude and LINEAR in phase. So you have to make a signal that has linear phase like

F = exp(-i*w*0.1);
F(51:end-50) = 0;
impulse = real(ifft(F));

you still going to have imaginary part (but it will be very small) because of the imprecision of the phase when you "zero" the hi-pass band. In the example, 50 will be cutoff frequency and 0.1 the desired group delay.

0
votes
  1. Create ideal frequency response.
  2. To create coefficients of filter use ifft of ideal frequecny response.
  3. To compute real frequency response add zeros to coefficients array and call fft of that array. My Problem was, that I wasn't adding zeros to coefficients array. And of course from coefficients I would then get same ideal frequency response.