# FFT of SIN waves with different phase delays

I have come across a peculiarity of FFTs which has got me somewhat baffled. I've simply summed up 101 sine waves and taken the FFT using this matlab script :

clear all
f=1e9;                                 % Centre Frequency 1GHz
df=2.5e6;                                % Carrier Frequency 2.5MHz
Time=linspace(-100e-9,100e-9,1000);      % Region of time to simulate over
delay=0;
Voltage=Time.*0;                        % Initialise Voltages to zero
for loop=-50:50                         % Sum 101 carrier Frequencies
Voltage=Voltage+sin(2.*pi().*(f+df.*loop).*(Time-delay));
end
figure(1)                               %Plot Time dependent response
subplot(2,1,1)
plot(Time,Voltage)
subplot(2,1,2)                               %Plot Frequency Content
dt=Time(2)-Time(1);
frequency=linspace(-0.5/dt,0.5/dt,1000);
spectrum=fftshift(fft(Voltage));
plot(frequency,abs(spectrum))


The output is as I had expected, with the correct frequency content : However, if I simply add a significant time delay (by re-running the script with delay=150e-9;, such that the main constructive interference lobe disappears outside the calculation window) the frequency content of the resulting time trace collapses to two peaks. However the time trace is still the summation of 101 sin waves albeit now out of phase because of the introduced delay ?? Intuitively I would have expected the absolute frequency content of the trace to be preserved and only the phases modified by the delay. Upon reflection I can perhaps understand that the frequency content must be modified on energy conservation grounds, but can anybody rationalise what is going on here ?

• Per hotpaw2s answer: Easy to see if you increase the delay gradually. The center blob in the middle shifts to the right and eventually moves out of the window. Your delay is about 750 samples which is more than half the window size. Jan 4 '16 at 13:42

You aren't looking at the frequency content of your sum of sinewave. You are looking at the frequency content of a rectangular window on your sinewaves, and the window (FFT length) is shorter than the least common multiple of all the sinewave periods.

Signals that are not orthogonal within a window can cancel each other out partially or completely within that window. What has happened is that you've chosen a window of a length such that each sinewave can get nearly completely cancelled out by the next higher and lower frequency pair of sinusoids of the "right" phase. The ones on the ends are the only ones that aren't sandwiched, and thus aren't cancelled.

• Thanks for the answer. I agree that this is what the FFT trace tells us, but is still surprising as the voltage consists of an orthogonal set of sinwaves (note 1GHz is an integer multiple of 2.5MHz, so you can rewrite the voltage signal as a summation of sin(2.pi.df.time.N) where N is an integer multiple). By definition these orthogonal sinewaves cannot cancel each other out ! Yet by narrowing the observation window you can achieve cancellation ? Jan 4 '16 at 20:09
• Intuitively this still makes no sense to me. Jan 4 '16 at 20:19
• Your time window is not 1/1GHz, but (100+100)/1GHz, over which two sinwaves of 1005 and 1002.5 GHz are not orthogonal. Jan 4 '16 at 20:39
• For intuition, use just two sinewaves and shrink the window to one sample. It's obvious that you can pick a point where the sum is zero Volts, e.g. complete cancellation, no matter how orthogonal the frequencies are over an infinite time period. Jan 4 '16 at 20:44

I have marked @hotpaw2 answer as correct, but after further thought I post a simple visual explanation of what is going on here.

Instead of taking the FFT of a complex pulse, consider instead a simple pulse as shown in the figure below. By applying a fourier series expansion, this pulse (or any pulse) can also be created from the weighted summation of an infinite set of orthognal sinwaves as defined in the original question. It is now fairly obvious that the FFT of the pulse within the red window will contain all the spectral content of the pulse (as shown in the first figure of the original question), where as the FFT of the green window will contain no spectral content at all (as shown in the second figure of the original question). This is true even though the trace within each window can still be constructed from the summation of a orthogonal set of sinwaves by the same fourier series expansion. The FFT window transforms the trace within the window onto a different orthogonal set of sinwaves, as described in @hotpaw2 answer. The original fourier series expansion used to construct the pulse and its corresponding frequency components are no longer relevant.