Visualizing the "frequency shift" theorem in FFT 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])
In the line

Inverse_GShifted=real(ifft(GShifted));


I have changed to 

Inverse_GShifted=real(fftshift(ifft(GShifted)));


This is because the ifft output is from $0 \le n \le N-1$, but your actual time output is symmetric about $n=0$. So what you have to do is to center it around $n=0$ by doing fftshift() command. It will give the output of $-N/2 \le n \le N/2-1$ whose plot is below



Regarding the zoomed output, the IFFT of gaussian function $G(f)$ is again Gaussian $g(t)$. It is getting modulated or point-by-point multiplied by $e^{j\omega_0 n}$ where $\omega_0 = 1400/4500\pi$ (considering $-\pi \le \omega_0 \le \pi$), which is the shift in frequency that you applied. ie, $g[n].*e^{j\frac{14}{45}\pi n}$. The period of this waveform turns out to be $\approx 6.43$ so you will see the peaks repeated after every 6 or 7 samples which is correct as per the zoomed plot. $14/45$ being irrational may be the reason why period is not an integer.