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:

Now, to give you an idea of what I am looking at, each 5-second sampling period is a "trial", and I havethousandsof 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 Idon'tknow 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!