Thread: A question about handling Fourier transform results

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743

    A question about handling Fourier transform results

    Hey y'all,

    Been years since I've posted here. Anyway, let's see if anybody can help me take a crack at this problem I'm having. It's programming related, but not code related nor C++ related (I'm actually using Matlab for this specific task), so I figured the GD board would be appropriate.

    I have an application that measures a force transducer at a 500 Hz sampling rate. Here is an example image of 5 seconds of data (2500 samples) from the force transducer:

    A question about handling Fourier transform results-pull_trial-png

    Now, to give you an idea of what I am looking at, each 5-second sampling period is a "trial", and I have thousands of trials. Literally thousands. I would like to examine the frequency spectrum of these trials, but more specifically I really only want to look at the frequency spectrum while the force is above 35 grams (in other words, while something is actually happening).

    This is easy enough. I can very easily dissect out all portions of every trial where the force is above 35 grams, run each of these through a Fourier transform, and get everything in the frequency domain. For the sake of brevity and clarity, from now on I will refer to each of these "above-35-gram-segments" as a "pull" (i.e. I am applying a pull force on the force transducer).

    The difficult part comes when I want to average these together to get an idea of what the "average frequency spectrum" looks like. Because each pull is a different duration, the frequency binning of the FFT will be different. A 500 Hz signal with 500 samples will have FFT bins of 1 Hz each. A 500 Hz signal of 100 samples will have FFT bins of 5 Hz each. So on and so forth. For the sake of accuracy, I am establishing a lower-bound of 200 ms pulls (5 Hz frequency bins in the resulting FFT). There is no upper bound, so a 500 Hz signal with 1000 samples could have 0.5 Hz frequency bins.

    Anyway, I know how to convert from FFT bins to real frequencies, that's not difficult. But what I don't know is how to do it a semi-continuous manner.

    For example, let's say I have a 112 sample pull (4.46 Hz frequency bins). I'd like "stretch" or "compress" the FFT result to fit on a scale of 1-50 Hz (I don't really need anything above 50 Hz, so I'm just gonna trash anything above). In this case I presume that the proper method would be to take the amplitude of the first bin (which represents from 0 Hz to 4.46 Hz), and divide the amplitude by the binning amount. The resulting amount of power would then be evenly distributed to the real frequencies:

    Real 0 Hz = FFT Bin 1 * (1/4.46)
    Real 1 Hz = FFT Bin 1 * (1/4.46)
    Real 2 Hz = FFT Bin 1 * (1/4.46)
    Real 3 hz = FFT Bin 1 * (1/4.46)
    Real 4 Hz = FFT Bin 1 * (0.46/4.46) + FFT Bin 2's contribution to this frequency

    This seems like it could get very complex very fast, and there is a lot of room for error.

    Am I off my rocker trying to do this? I can't find any examples of people doing this on the internet, basically I only see examples of people doing conversions of single bins to single frequencies, and back.

    I would like to scale my FFT result to the corresponding real frequency spectrum all while keeping the POWER constant (the power shouldn't change as a result of doing this operation), so that I can average the results of all of these FFTs together.

    SO, if any of you have any suggestions on how to approach this problem, I'd love to hear your ideas!
    Last edited by DavidP; 04-07-2015 at 11:41 PM. Reason: Corrected frequency binning stuff
    My Website

    "Circular logic is good because it is."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fast Fourier Transforms, k values?
    By birdhen in forum C Programming
    Replies: 6
    Last Post: 12-05-2011, 05:19 PM
  2. An efficient storage scheme for fourier data
    By Sebastiani in forum General Discussions
    Replies: 16
    Last Post: 11-07-2010, 01:22 PM
  3. Fourier Transform
    By srikanthreddy in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2005, 08:36 AM
  4. fourier transform in C
    By blinky in forum C Programming
    Replies: 4
    Last Post: 02-25-2004, 12:27 PM
  5. fourier transform support
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-28-2002, 11:59 AM