I was trying to visualize the frequency shift theorem in MATLAB, which states that if the Fourier transform G(f) is shifted by a constant $f_o$, its inverse transform g(t) is multiplied by $e^{j2\pi tf_o}$.
Say one makes two symmetric real valued Gaussians (G(f)) in the frequency domain as shown in the code below as a function of bin numbers. The peaks are symmetrically displaced from the center bin by a constant. When the inverse FFT is applied G(f), the output g(t) looks look the attached photo. A displaced Gaussian in the frequency domain should produce a Gaussian multiplied by cosine waves. Intuitively, it does appear like an exponential decay times a cosine wave.
a) The FFT of a Gaussian is a Gaussian, but g(t) looks like exponential decay times a cosine. b) Another point is why do we see a two-sided symmetric output in the time domain? Shouldn't we see only one sided result in the time domain?
What is the discrepancy here in the time domain?
Thanks.
Frequency Shift Theorem
W=[1:1:9001]'; % bin numbers
n=1; % Gaussian shape, n=1 Gaussian
H=10; % Height of Gaussian
s=25; % standard deviation in frequency domain
w_left=1400; % Position of Gaussian as bin numbers
w_right=length(W)-w_left; % Position of Gaussian as bin numbers
G_left=H*exp(-((W-w_left).^2/(2*s^2)).^n);
G_right=H*exp(-((W-w_right).^2/(2*s^2)).^n);
GShifted=G_left+G_right;
Inverse_GShifted=real(ifft(GShifted));
figure (1)
subplot (1,2,1)
plot (W, GShifted,'r', 'LineWidth', 1.5);
title ('Shifted Gaussian in Frequency Domain')
xlabel('Bin Numbers (Frequency)')
ylabel('Real')
xlim([1 9001])
subplot (1,2,2)
plot (W, Inverse_GShifted,'b', 'LineWidth', 1.5);
title ('Inverse FFT of Shifted Gaussian')
xlabel('Bin Numbers (Time)')
ylabel('Real Part')
xlim([1 9001])