Path: news.mathworks.com!not-for-mail
From: "Michael Stachowsky" <mstachowsky@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: FFT acting strangely...
Date: Fri, 29 Feb 2008 19:56:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <fq9o0h$o6s$1@fred.mathworks.com>
Reply-To: "Michael Stachowsky" <mstachowsky@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1204314961 24796 172.30.248.35 (29 Feb 2008 19:56:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 29 Feb 2008 19:56:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1276742
Xref: news.mathworks.com comp.soft-sys.matlab:454667


I am trying to perform an FFT on some data.  My data is:

times = [1:1000];
accelArray = 0.7*sin(50*times);

Then I do:

fftAccel = (fft(accelArray))/length(accelArray);
fftFreqs = Fs/2*linspace(0,1,length(accelArray)/2);

Then, when plotting, I do this:

plot(fftFreqs,2*abs(fftAccel(1:length(accelArray)/2)));

Now, I'm expecting to get a peak at 50Hz, but instead I get
a peak at 42.8Hz.  I've tried to put sin(2*pi*50*times), but
that just gives me numbers that are close to 10^-11.

Any ideas?

Mike