1
$\begingroup$

We know that a convolution in the time domain equals a multiplication in the frequency domain. As per the article below,

https://www.dspguide.com/ch9/3.htm

In order to multiply one frequency signal by another, (in polar form) the magnitude components are multiplied by one another and the phase components are added. To prove this, i created two sinusoidal signals in MATLAB,

Freq1 = 1000;
Freq3 = 3000;
Fs = 16000;
T = 1/Fs;
Nos = (0:128-1)*T;
Amp = 1.0;
Signal1 = Amp*sin(2*pi*Freq1*Nos);
Signal3 = Amp*sin(2*pi*Freq3*Nos);

In the time domain, i convolved these two signals,

Signal4 = conv(Signal1,Signal3); 

Taking a 32 point FFT of the two signals & and a 32 point FFT of the convolved signal,

NFFT = 32;
freqdata1 = fft(Signal1,NFFT);
freqdata2 = fft(Signal3,NFFT);
freqdata4 = fft(Signal4,NFFT);

in the frequency domain, i multipled the magnitude components of the two individual signals and added the phase component of the two signals. I compared this Magnitude and phase value with the Convolved signal's phase and magnitude value. I expected the values, [Newmag' NewPhase'] & [Mag3' Phase3'] to be similar since the a convolution in time domain equals a multiplication in the frequency domain. But they are not. What am i missing here ? What have i done wrong ?

for ii = 2:((length(freqdata1)/2)+1)

   sig1_cc = real(freqdata1(1,ii));
   sig1_dd = imag(freqdata1(1,ii));
   Mag1(ii-1) = sqrt((sig1_cc^2)+(sig1_dd^2));
   Phase1(ii-1) = atan(sig1_dd/sig1_cc);

   sig2_cc = real(freqdata2(1,ii));
   sig2_dd = imag(freqdata2(1,ii));
   Mag2(ii-1) = sqrt((sig2_cc^2)+(sig2_dd^2));
   Phase2(ii-1) = atan(sig2_dd/sig2_cc);  

   sig3_cc = real(freqdata4(1,ii));
   sig3_dd = imag(freqdata4(1,ii));
   Mag3(ii-1) = sqrt((sig3_cc^2)+(sig3_dd^2));
   Phase3(ii-1) = atan(sig3_dd/sig3_cc);

   Newmag(ii-1) = Mag1(ii-1)*Mag2(ii-1);
   NewPhase(ii-1) = Phase1(ii-1) + Phase2(ii-1); 

end

[Newmag' NewPhase']
[Mag3' Phase3'] 
$\endgroup$

1 Answer 1

1
$\begingroup$

You missed the part where under the DFT, multiplication in one domain is equivalent to circular convolution in the other. Standard problem!

Just pad the signals you want to convolve with enough zeros on both sides, and things will look better.

Also, I hope you're just doing this as to exercise your matlab coding, because getting the phase out of two complex numbers just to multiply them is way, way, way more computationally intense than just directly multiplying the two numbers.

$\endgroup$
1
  • $\begingroup$ Ahh. After padding the signals, they do look better. Not perfect, but better. Thank you. Oh yes. I'm using the Phase calculation just as an exercise. $\endgroup$ May 8, 2019 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.