Filters for Real World Accelerations

In summary: FFT?)If you take an FFT of all the data and set just the "zero frequency" Fourier coefficient to 0, then you can integrate the data in the frequency domain by dividing the fourer coefficients by ##i\omega## or ##-\omega^2##.
  • #1
cciarleg
7
0
Hi,

I'm having trouble with the application of filtering to real acceleration data. I have looked at a lot of recommendations, filtering through fft, butterworth high and low pass filters, and I'm not finding something that's working for my data and I'm looking for recommendations.

I think my problem is that I am looking at very slow accelerations, so the "drift" in the accelerometer is eliminated-but so is the trend in the data itself. I will be looking at the cases of relatively slow acceleration and velocity, and slow acceleration with pauses in between sequences. A low pass filter does okay-but does not provide an accurate map of displacement in the end. Using an fft seems to also eliminate the slower trend in the data.

I have also added in elimination of values less than the abolsute mean found for a static case. This seems to help a little bit, but I may be losing some data.

I have attached a couple of examples of what the problem is. I made a rectangle with the accelerometer pretty much and these are the results with no filters and a low pass filter.
First 2 are no filter. 2nd 1 is the LP filtered accel. (I can send velocity if interested-looks the same pretty much)

Are there any other filters I should be trying? Different methods of integration? (I am currently using a trapazoidal integrator). I'm pretty much looking for recommendations processing this type of data.

Thanks! (I also hope this is the correct thread for this).
 

Attachments

  • Test1AccelUF.jpg
    Test1AccelUF.jpg
    16.1 KB · Views: 433
  • Test3VelUF.jpg
    Test3VelUF.jpg
    12.2 KB · Views: 393
  • Test1AccelLPF.jpg
    Test1AccelLPF.jpg
    16.7 KB · Views: 432
Physics news on Phys.org
  • #2
Integrating the accelerations twice to get displacements is equivalent to a high pass filter, without doing anything to the raw data. It multipliies a component with frequuency ##\omega## by ##-1/\omega^2##.

Filtering the data in the time domain can be problematic if the filter introduces phase shifts in the different frequency components of the measured data. You can design finite impulse response (FIR) digital filters that don't introduce phase shifts, but unless there is a specific noise problem (e.g. vibration or electrical noise at a particular frequency that you want to remove) you probably don't need to do it at all.

A common problem with this sort of measurement is low frequency "drift" because the accelerometer readings are not exactly correct for zero acceleration. One way to fix that is do it empirically. If you know the start and end positions independent of the accelerometer data, add a constant acceleration that makes the end point of the graph correct, i.e. use the formulas ##v = at##, ##x = at^2/2## to estimate the "zero error acceleration" ##a##.

Trapeziod integration is probably as good as anything. It uses all the data without "inventing" anything extra, or throwing any information away.

Another practical tip is use the highest data sampling rate than you can, to capture rapid changes of acceleration as accurately as possible. Unfortunately there is usually a trade off between capturing the peak acceleration values without clipping, and getting accurate data when the accleration is low.

If you can do your experiment so the start and end positions are the same, you can enforce that by taking an FFT of all the data, and setting just the "zero frequency" Fourier coefficient to 0. You can then integrate the data in the frequency domain by dividing the fourer coefficients by ##i\omega## or ##-\omega^2## before doing the inverse FFT, rather than doing the integration in the time domain with the trapezoidal rule.
 
  • #3
Okay, that helps a little. Maybe you can help me with the underlying understanding of the FFT as that seems to be one of my issues. I can guarantee for this particular experiment that the start and end point are always the same (to a relatively high degree of accuracy).

So-I'm trying to map my accelerations into the frequency domain. That means those acceleration points now become termed Fourier coefficients after the fft? Does this also mean that I randomly set the first one in the array to zero?

To get the Ω associated with each Fourier coeffcient, I am a little confused. I can get the sampling frequency by looking at 1/T. (Lets say for experiments' sake that I do this calculation for a sampling period of 0.005s and get 200 Hz for my sampling frequency.)

Does that mean I just divide my new Fourier coefficients by that same Ω? (200 Hz or whatever it is-although this looks like Ω needs to be in rad/sample?) The previous comes out very wrong so I assume I'm making at least some incorrect assertions.

Or does each coefficient have a specific Ω value that can be found somehow? Is this what you mean by "zero frequency" Fourier coefficients in that there will be values throughout my coefficient array that are specifically associated with Ω =0? (not necesarily the first coefficient).

I had a question also about finding a characteristic acceleration that can be used to cancel out the offset. I understand I want my acceleration integral and velocity integral to be zero in the end to achieve start/stop in the same place. But how can this be applied to an array of data where the equation is unknown and, in all likelihood, to get accurate results, a changing acceleration is needed to not only allow the displacement to end at 0, but to also allow the inbetween values to be accurate? How do I go about looking for that equation where I have
[itex]v_{n} = v_{n-1} + a_{n-1}(t_n - t_{n-1})[/itex]

[itex]x_{n} = x_{n-1} + v_{n-1}(t_n - t_{n-1}) + \frac{1}{2} a_{n-1} (t_n - t_{n-1})^2[/itex]

and I probably need a unique acceleration between each time step? especially where all I know are the endpoints and not the exact location after each time step?

Sorry for the multitude of questions. Thanks.
 
  • #4
cciarleg said:
To get the Ω associated with each Fourier coeffcient, I am a little confused. I can get the sampling frequency by looking at 1/T. (Lets say for experiments' sake that I do this calculation for a sampling period of 0.005s and get 200 Hz for my sampling frequency.)

Does that mean I just divide my new Fourier coefficients by that same Ω? (200 Hz or whatever it is-although this looks like Ω needs to be in rad/sample?) The previous comes out very wrong so I assume I'm making at least some incorrect assertions.

Or does each coefficient have a specific Ω value that can be found somehow? Is this what you mean by "zero frequency" Fourier coefficients in that there will be values throughout my coefficient array that are specifically associated with Ω =0? (not necesarily the first coefficient).

If you have a N data points and sample interval of T, you get N Fourier components which represent frequencies of ##0##, ##1/(2NT)##, ##2/(2NT)## ... ##(N-1)/(2NT)## Hz.

To get the corresponding ##\omega##'s in radians/sec you multiply by ##2\pi## of course.

Each Fourier component represents a "sine" and a "cosine" wave of that particular frequency. Each component is a complex number (even if your original measured data was real numbers) and the real and imaginary part of each coefficient represent the amplitudes of the cos and sin waves.

So you need to divide each coefficient by the corresponding ##i\omega## or ##-\omega^2##.

(If you look at websites or testbooks about this, you might discover I've left out some issues about what the "zero frequency" coefficient means when you do an FFT of complex data - but your measured data is real numbers, not complex, so you don't need to bother about that)

I had a question also about finding a characteristic acceleration that can be used to cancel out the offset. I understand I want my acceleration integral and velocity integral to be zero in the end to achieve start/stop in the same place. But how can this be applied to an array of data where the equation is unknown and, in all likelihood, to get accurate results, a changing acceleration is needed to not only allow the displacement to end at 0, but to also allow the inbetween values to be accurate?

You can't get everything accurate. The best you can do is "spread out" the errors evenly do at least the final position is correct.

If you start and end with the same displacement (if doesn't matter if you measure it as 0, or something else) that means the average velocity in the experiment was zero. Similarly if you start and end with the same velocity, the average acceleration is zero.

So you can calculate the average acceleration that you measured, and subtract that from every acceleration measurement.
Then do the integration to find the velocities, as you did before.
Then calculate the average velocity, and subtract that from your calculated values.
Then do the integration to find the displacements.

Actually these two methods are really the same, because the Fourier coefficient for the zero frequency is just the average of the data points.
 
  • #5
okay-that at least makes sense theoretically, thank you.

getting it to work in real life-looks like I have a bit more work to do. Neither of the 2 methods quite makes the true rectangle out of the data yet (as shown below, first averaging, then FFT) but the values are in the right range, which is good.

Code:
function disp_time_data = acc2disp(acc_time_data,dt)

N = length(acc_time_data);

acc_freq_data = fft(acc_time_data);

disp_freq_data = zeros(size(acc_freq_data));
disp_freq_data(1) = 0;

for i = 2 : N
      disp_freq_data(i) = acc_freq_data(i)/( sqrt(-1)*(2*pi*((i-1)/(2*N*dt))) );
end
disp_time_data = ifft(disp_freq_data);    

return

Although, I actually had to square the bottom term (ωi) to get the graphs to be the same shape (picture 3 is the fft with the bottom term squared), which I was a little curious about, as well as why the FFT graph was offset compared to the averaging techniques. I'm hoping that I don't see a rectangle yet because on this one test, I did not end up in exactly the same place I started?
 

Attachments

  • Test3AvMethod.jpg
    Test3AvMethod.jpg
    15.4 KB · Views: 373
  • Test3FFTmethod.jpg
    Test3FFTmethod.jpg
    13.9 KB · Views: 400
  • Test3FFTmethod2.jpg
    Test3FFTmethod2.jpg
    14.9 KB · Views: 367
  • #6
If the accelerations for one Fourier component are ##Ae^{i\omega t}## (where ##A## is the Fourier coefficient), integrating once to get the velocities gives ##Ae^{i\omega t}/(i\omega)## and integrating again to get the displacements gives ##-Ae^{i\omega t}/\omega^2##

If you integrate the FFT data, the origin will be at the mean of all the data points in X and Y. The zero Fourier coefficient represents the mean value of the data points, and you set it to 0. (Try setting it to some other value and see what difference it makes).

On the other hand, when you do the integration in the time domain, you are arbitrarily setting the first data point to be at (0,0). Again, you could use a different value if you want.

Just a thought on doing the experiment: remember the accelerometers measure accelerations in the direction they are pointing, not in the global X and Y directions. Maybe you are accidentally rotating the object as you move it around the path.
 
  • #7
Cool! Thats kind of interesting to see.

I had been thinking about local reference frame actually in trying to solve my real problem, but I actually don't have a fixed global reference frame that I "know" about, at least not yet, that's a part of what this is about.

I suppose I could set, for this purpose, the first position as the "fixed" frame for subsequent measurements. But even then, especially as I have no idea what the path is, I wouldn't have a method of determining the transformation matrix to get from one frame to the next. (okay, I will know its an arc of undetermined radius-maybe there's an optimization or something I could do with that... although initial position of the accelerometer frame relative to the frame at the base of the arc is unknown in both rotation and translation)

I just did a decently precise circle with the accelerometer (where the accelerometer is fixed to the edge of a rotating disc), where the frame is changing all the time, to see what the result would be. I wonder if that local frame integration, without a static frame, is what causes the units and the shape to be so off in a position graph.
 

Attachments

  • Test4AccurateSum.jpg
    Test4AccurateSum.jpg
    12.4 KB · Views: 403
  • Test4AccurateFFT.jpg
    Test4AccurateFFT.jpg
    12.2 KB · Views: 433
  • #8
Was that a circle at constant RPM? Was it rotating in a horizontal plane or a vertical plane (where gravity would affect what you measure?)

If you fix the accelerometers to a rotating dosk at constant speed in the horizontal plane, you should measure a constant acceleration towards the center (= ##r\omega^2##). If not, I think you need to figure out exactly what you ARE measuring here.
 
  • #9
horizontal plane with variable acceleration and variable velocity (I actually stopped and restarted the motion about 200 degrees around or there about before completing the circle).
I had wanted to do a case with uncertian accelerations, but a constant accel case might be easier to calculate for functionality.
 

1. What are "Filters for Real World Accelerations"?

"Filters for Real World Accelerations" refer to a type of signal processing technique used to remove unwanted noise and artifacts from accelerometer data collected in real-world settings. These filters can help improve the accuracy and reliability of data analysis in various fields such as sports science, automotive engineering, and aerospace.

2. How do these filters work?

Filters for real world accelerations work by applying mathematical algorithms to the raw accelerometer data. These algorithms help identify and remove unwanted noise and artifacts, leaving behind only the most relevant and accurate data points.

3. What types of noise and artifacts can these filters remove?

Filters for real world accelerations can remove a variety of noise and artifacts, including sensor drift, random noise, and environmental interference. They can also correct for biases and errors in the data caused by factors such as sensor misalignment or temperature changes.

4. What are the benefits of using these filters?

The use of filters for real world accelerations can improve the accuracy and reliability of data analysis, leading to more precise and meaningful results. They can also help save time and resources by reducing the need for manual data cleaning and processing.

5. How can these filters be implemented in research or practical applications?

Filters for real world accelerations can be implemented in various ways, depending on the specific needs and goals of the research or application. They can be applied to data in real-time or in post-processing, and can be customized to filter out specific types of noise and artifacts. Some software packages also offer pre-built filter settings for common scenarios.

Similar threads

Replies
5
Views
2K
  • Electrical Engineering
2
Replies
51
Views
6K
Replies
5
Views
1K
  • Mechanics
Replies
10
Views
1K
Replies
9
Views
2K
Replies
20
Views
3K
Replies
1
Views
8K
  • Mechanics
Replies
1
Views
2K
Replies
9
Views
1K
Replies
1
Views
2K
Back
Top