Reputation: 63
I have a signal that i am doing an FFT to, doing an convolution with itself and then an IFFT back to the time domain. The signal is 8192 long. If i pad the signal to 16384 (N*2) and perform the operations i get the correct output. However, is this necessary? But when i try and stick with 8192 using C2C FFT transforms I have similar data throughout until the IFFT. (When using 8192 it only has every 2nd point from the 16384 data).
I've run this through matlab and got the same results so i suspect its more to do with the maths than the implementation, but as I'm doing this in cuda, any advice is welcome, I don't mind having to pad the data in some shape if necessary but the data is fine up to the point i do the IFFT.
N.B I know i'm not doing all computation on the GPU, this was simply to remove errors and allow me to see what the code was doing.
Link to code: http://pasted.co/e2e5e625
This is what i get if i don't pad.
Upvotes: 0
Views: 234
Reputation: 14579
I have a signal that I am doing an FFT to, doing an convolution with itself and then an IFFT back to the time domain.
Looking at your code, you are not doing a "convolution with itself" in the frequency domain but rather a multiplication by itself.
The entire sequence of operations (FFT, multiplication, IFFT) would correspond to computing the circular convolution of the signal with itself in the time domain. The circular convolution would only be equivalent to a linear convolution if the signal is first padded to a length at least 2*N-1
(which happens to be the minimum size required to store all linear convolution coefficients after the IFFT).
You may use a smaller FFT size (i.e. smaller than 2*N-1
, but at least N
) to compute a linear convolution by using the Overlap-add method.
Upvotes: 2