0
$\begingroup$

I have FFT of two signals. Y=120 , Y1=80 Hz. to convolve in time domain I can convolve them using their ffts. as Y3= (Y).*(Y1); I can get Y by dividing as Y3./(Y1)

Y=Y3./(Y1);

But if take ifft of Y3. and shift it to 5 sample and at the end of the signal is padded with some zeros. after shifting I take FFT(shifted_Y3). and try to get Y using FFT(shifted_Y3)./(Y1). But I get distorted signal... Why that so? although frequency spectrum is same of Y3 and shifted_Y3. last left plot is result of fft(shifted_Y3)./Y1 and last right plot is result of Y3./(Y1)

Why I am getting recovered signal with added components. Is there any way to avoid this in shifted signal?

Fs = 1000;            % Sampling frequency
T = 1/Fs;             % Sampling period
L = 1000;             % Length of signal
t = (0:L-1)*T;        % Time vector
S = 0.7*sin(2*pi*120*t);

bb=zeros(1,200);

figure
%subplot(4,2,1);
%plot(S)
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(4,2,1);
plot(f,P1)
title('Single-Sided Amplitude Spectrum of Y(t)')
xlabel('f (Hz)')

S = 0.7*sin(2*pi*80*t);
%subplot(4,2,3);
%plot(S)
Y1 = fft(S);
P2 = abs(Y1/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(4,2,2);
plot(f,P1)
title('Single-Sided Amplitude Spectrum of Y1(t)')
xlabel('f (Hz)')


Y3=Y1.*Y;
P2 = abs(Y3/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
subplot(4,2,3);
plot(f,P1)
title('conv by multiplying fft of both above signals Y3 =Y1.*Y;')
xlabel('f (Hz)')

out_ifft = ifft(Y3);
subplot(4,2,4);
plot(out_ifft)
title('conv-result in time domain')


 div_fft = Y3./Y1;
  P2 = abs(div_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
  subplot(4,2,8);
plot(f,P1)
title('in fft not-timeshifted./Y1')


c=cat(2,out_ifft,bb);
out_ifft1=c(5:1:1004);
subplot(4,2,5);
plot(out_ifft1)
title('in-timeshifted= 5 sample shifted conv-result in time domain')



 in_fft = fft(out_ifft1); 
 P2 = abs(in_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
 subplot(4,2,6);
plot(f,P1)
title('in-fft-timeshifted = Single-Sided Amplitude Spectrum of 5 sample shifted conv-result')
xlabel('f (Hz)')

  div_fft = in_fft./Y1;
  P2 = abs(div_fft/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
  subplot(4,2,7);
plot(f,P1)
title('in-fft-timeshifted./Y1')

spectrums

$\endgroup$
  • $\begingroup$ Your question is hard to follow. Can you provide the code you used? Looking at your y-axis values, some observations: The product of Y and Y1 is almost zero (the peaks are at totally different positions). Therefore, the convolution product is also very small. You might run into numerical problems even. It looks like you convolve two sines of different frequencies, but did not have an exact integer period of the sine. Also note, that your approach does circular convolution and not linear convolution. $\endgroup$ – Maximilian Matthé Mar 29 '17 at 7:04
  • $\begingroup$ thanks for comments. I am attaching code. yes I have two sine waves Y,Y1 and convolve them by multiplying their FFTs and obtain the result in Y3. then I take IFFT of it. shift it by 5 samples. again took its FFT now I want to recover Y signal by dividing it by Y1. lowest left plot is the result of division of FFT of shifted resultant and Y1. Lowest right plot is division of not shifted version of resultant and Y1. Why in lowest left plot i am getting other frequency components? How can I recover signal from convoluted resultant if it is shifted in time domain.? $\endgroup$ – Haris_tech Mar 29 '17 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.