Go back to previous page
Forum URL: http://www.cut-the-knot.org/cgi-bin/dcforum/forumctk.cgi
Forum Name: College math
Topic ID: 562
Message ID: 0
#0, spectral analysis question
Posted by alan on Mar-10-06 at 06:04 PM
I'm trying to teach myself a little bit about fourier series and spectral analysis. I'm using matlab to create a plot of the power spectrum of a simple periodic signal, but I don't quite understand why the plot looks like it does. The signal is y=sin(50*2*pi*t)+sin(75*2*pi*t)+sin(125*2*pi*t). The power spectrum has spikes at 50, 75, 125 as expected, but there are also spikes at 375, 425, 450. I'm using the matlab function FFT(x,N) which computes a discrete fourier transform of the signal x using N points. I'm using N=500, so obviously the three extra spikes are related to that number, but I don't understand exactly how. My guess is it has something to do with the corresponding negative frequencies, but I don't understand how this implementation of the DFT is treating those frequencies.

The code I'm using:

function spec()
dt=.002;
N=500;
f1=50;
f2=75;
f3=125;

t = 0:dt:0.6;
y = sin(f1*2*pi*t)+sin(f2*2*pi*t)+sin(f3*2*pi*t);
Y = fft(y,N);
Pyy = Y.* conj(Y)/N;
f = (0:(N-1))/(N*dt);
plot(f,Pyy)

The code is pretty simple, it should be easy to understand for anyone familiar with programming (just in case, conj(x) is the complex conjugate of x, and the notation 0:(N-1) produces an array of N points starting at 0). The resulting plot is here: http://web.ics.purdue.edu/~abernste/fourier.gif

Any help would be appreciated.