My Math Forum  

Go Back   My Math Forum > College Math Forum > Applied Math

Applied Math Applied Math Forum


Reply
 
LinkBack Thread Tools Display Modes
June 18th, 2009, 07:39 PM   #1
Newbie
 
Joined: Jun 2009

Posts: 1
Thanks: 0

FFT on sample data

Hi

I am trying to perform Fast Fourier Transforms on sample data coming out of a load cell. (Load cells are weighing at 10items a second) I have got the data in excel (256 values = 3 items). I am using Matlab to do this. Code below:

x=Load_Cell_Data(:,2)

nfft= 2^(nextpow2(x)); % Use next highest power of 2 greater than or equal to length(x) to calculate FFT
fftx = fft(x,nfft); % Take fft, padding with zeros so that length(fftx) is equal to nfft

% Calculate the numberof unique points (half)
NumUniquePts = ceil((nfft+1)/2); %ceil rounds up to nearest integer
% FFT is symmetric, throw away second half
fftx = fftx(1:NumUniquePts);

% Take the magnitude of fft of x
mx = abs(fftx)

% Evenly spaced frequency vector with NumUniquePts points.
f = (0:NumUniquePts-1)

% Generate the plot, title and labels.
plot(f,mx);
title('FFT');
xlabel('Frequency (Hz)');
ylabel('Amplitude');

Comments added to show train of thoughts. I get a graph which doesn't look right. What am I missing in the code? I am not getting distinct frequency components which one would expect to see with such application.

Thanks for your help in advance.
Ramyy
ramyy is offline  
 
June 29th, 2009, 04:49 PM   #2
Newbie
 
Joined: Jun 2009

Posts: 5
Thanks: 0

Re: FFT on sample data

Looks wrong how? Shape or amplitude? I notice that you're not dividing the number of samples.
fftx = fft(x,nfft)/nfft;

Also, maybe try windowing?
fftx = fft(x .* hann(nfft),nfft)/nfft;
drjones is offline  
Reply

  My Math Forum > College Math Forum > Applied Math

Tags
data, fft, sample



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
sample proportion of the sample mean shivadiva Advanced Statistics 0 April 30th, 2013 07:46 PM
Rolling 3 months YOY data to Monthly YOY data lumpa Real Analysis 0 October 19th, 2012 08:07 AM
Sample mean Student@work Algebra 3 February 12th, 2012 08:17 AM
Random sample with zero sample mean Freddy7 Algebra 0 October 20th, 2011 08:52 AM
How to regress actual data towards projected data. BigLRIP Advanced Statistics 1 May 18th, 2009 10:01 AM





Copyright © 2019 My Math Forum. All rights reserved.