DSPRelated.com
Forums

Convolution and IFFT

Started by tomcat123 July 23, 2008
Hi, all, I am new to DSP. I try to verify the convolution in time domain
equal to the mulitplication in freq domain. I have a input signal of 128
points and a filter of 30 points. I do FFT of the input signal and
filter(pad zero). end up with 128 points of both signal in freq domain. I
then do multiplication of the two.
In time domain, I do convolution of the input signal and the filter, which
end up with 128+30-1 = 157 points. As the book says, the first and last 30
points are invalid so I get rid of them, end up with 98 points of convolved
signal.
I now want to do FFT of the 98 points that I get in time domain to see if
I can get exactly the same result as freq domain, but I only have 98 points
and padding zero will cause the result not match. Is there any way out or I
did something wrong in verifying??
Thanks.


On Jul 24, 2:25&#4294967295;am, "tomcat123" <liangliang.S...@eagletest.com> wrote:
> Hi, all, I am new to DSP. I try to verify the convolution in time domain > equal to the mulitplication in freq domain. I have a input signal of 128 > points and a filter of 30 points. I do FFT of the input signal and > filter(pad zero). end up with 128 points of both signal in freq domain. I > then do multiplication of the two. > In time domain, I do convolution of the input signal and the filter, which > end up with 128+30-1 = 157 points. As the book says, the first and last 30 > points are invalid so I get rid of them, end up with 98 points of convolved > signal. > I now want to do FFT of the 98 points that I get in time domain to see if > I can get exactly the same result as freq domain, but I only have 98 points > and padding zero will cause the result not match. Is there any way out or I > did something wrong in verifying?? > Thanks.
The result of your convolution is, as you state, 157 samples long. I'm not so sure that the first and last 30 points are 'invalid', although it may be that what you are most interested in will be in the central portion of your convolution result. In order to get a 157 sample time domain result from the DFT you need to use a 157 point DFT (or 256 point FFT). Zero pad both your input signal and filter coefficients to at least 157 points and then DFT, multiply, IDFT. Google 'overlap add' if you are interested in using the DFT to convolve longer input sequences.
On 24 Jul, 03:25, "tomcat123" <liangliang.S...@eagletest.com> wrote:
> Hi, all, I am new to DSP. I try to verify the convolution in time domain > equal to the mulitplication in freq domain. I have a input signal of 128 > points and a filter of 30 points. I do FFT of the input signal and > filter(pad zero). end up with 128 points of both signal in freq domain. I > then do multiplication of the two. > In time domain, I do convolution of the input signal and the filter, which > end up with 128+30-1 = 157 points. As the book says, the first and last 30 > points are invalid so I get rid of them, end up with 98 points of convolved > signal.
Which book says that the end samples are 'invalid'? That's not the case. The end samples are start and end transients, whuch is a different thing than 'invalid'.
> I now want to do FFT of the 98 points that I get in time domain to see if > I can get exactly the same result as freq domain, but I only have 98 points > and padding zero will cause the result not match. Is there any way out or I > did something wrong in verifying??
You are almost right, the error being caused by the statement that end transients are 'invalid'. If the (FIR) filter is 30 samples and signal 128 samples, the time-domain convolved sequence will be 157 samples long. The trick is to use a 157 pt FFT to reproduce the time-domain convolution. In matlab: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % x is 128 samples long % h is 30 samples long X=fft(x,157); H=fft(h,157); Y=X.*H; y=real(ifft(Y)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% y should now be the same as you get with time-domain convolution. Rune
Thanks for everyone!