"multiplication in the time domain is convolution in the frequency domain" -- how to perform these operations with discrete data?

10 views (last 30 days)
The code below compares the results of
1. multiplying two signals together, taking the fft, then computing the power
2. taking the fft of each signal, convolving the results, then computing the power
I expected these to be the same, but they are not. Can anyone tell me how to fix the code below so that the final results are identical? Part of this seems to be a scaling issue, but not all.
N=1001;
x=randn(1,N); w=randn(1,N); % random signals
% multiply then take fft
temp1=fftshift(fft(w.*x));
r1=conj(temp1).*temp1;
% take fft then do convolution
X=fftshift(fft(x));
W=fftshift(fft(w));
temp2=conv(X,W,'same');
r2=conj(temp2).*temp2;
% calculate the discrepency
d=sum(abs(r1-r2))
% plots
subplot(211);
plot(pow2db(r1))
subplot(212);
plot(pow2db(r2))
  1 Comment
Peeyush
Peeyush on 1 Jun 2015
The following points are important to remember:
1)FFT is different from continuous time Fourier Transform. However, even the maximum amplitude of the Fourier Transform of a continuous-time cosine function is NOT EQUAL to 1; instead, it is: ∞∗π
2)The signal is truncated and sampled in order to calculate the DFT/ FFT. Thus, the maximum amplitude will be scaled by both the Sampling Frequency (Fs) and the truncated signal length. The below link explains more about it: http://blogs.mathworks.com/seth/2009/01/30/mathworks-conversations-and-the-fft/

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!