seharryssona
Newbie level 1
Dear all,
I am new to the subject of signal processing and have some (probably elementary) questions that I currently could not find the answer to. The questions are all related to FFT and filtering.
I think I have figured out why the window method is used then doing a FFT, and have also tested this with some simple python code as below:
However, when it comes to FFT filtering, how does the different window methods enter into the equations? If I would like to construct a bandpass filter, say with the the amp = [0,1,1,0] at freqs = [2.0, 2.2, 2.8, 3.0], how do the different windows come into the code? I have tried according to:
i.e. I used the result from the FFT when the hamming window was applied to the original signal as a starting point to do the filtering. In order to check if this code ended up in something useful, I imported the signal into the music program Cool Edit, and performed a similar filtration. However, the results was not very similar when it comes to the amplitudes of the filtered signal.
If any one could give me some ideas on what to do, and perhaps point out where I get things wrong in my code, I would be very happy.
Regards,
Anders
I am new to the subject of signal processing and have some (probably elementary) questions that I currently could not find the answer to. The questions are all related to FFT and filtering.
I think I have figured out why the window method is used then doing a FFT, and have also tested this with some simple python code as below:
Code Python - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # Sampling data sr = 40 t_end = 4 n_samp = sr*t_end n = 512 # Create time axis and freq axis t = linspace(0,t_end,n_samp) F1 = arange(-n/2.0,n/2.0)/n*sr # Create output y2 = 2*sin(4.03452*pi*t)+3*sin(5.2123*pi*t)+1*sin(8.3212*pi*t) # Window w = hamming(len(t)) # Do fft of signal X2 = fft(y2*w,n=n) X2_s = fftshift(X2)
However, when it comes to FFT filtering, how does the different window methods enter into the equations? If I would like to construct a bandpass filter, say with the the amp = [0,1,1,0] at freqs = [2.0, 2.2, 2.8, 3.0], how do the different windows come into the code? I have tried according to:
Code Python - [expand] 1 2 3 4 5 6 7 ff = (0,1,1,0) Hz = (2.0, 2.2, 2.8, 3.0) k1 = interp(-F1,Hz,ff)+interp(F1,Hz,ff) w2 = hamming(len(k1)) X2_f = X2_s*k1*w2 X2_f = ifftshift(X2_f) x2_f = ifft(X2_f,n=int(n))
i.e. I used the result from the FFT when the hamming window was applied to the original signal as a starting point to do the filtering. In order to check if this code ended up in something useful, I imported the signal into the music program Cool Edit, and performed a similar filtration. However, the results was not very similar when it comes to the amplitudes of the filtered signal.
If any one could give me some ideas on what to do, and perhaps point out where I get things wrong in my code, I would be very happy.
Regards,
Anders