Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matlab Accelerometer Data to Velocity V2.0

Status
Not open for further replies.

sanchezb

Civil/Environmental
Feb 5, 2012
10
CA
thread384-296403

The aforementioned thread presents a code that deals with a normal sin wave quite well; however, I introduced noise into the code by adding a 2.5hz sin wave, 5hz sin wave and 25hz sin wave, which produced some unexpected results. See the attached graph for further details, the green line is direct integration of the signal and the blue line was the result of the FFT method. Any help on how to "twist" the FFT results so that it fits better would be greatly appreciated!!!
 
Replies continue below

Recommended for you

You need to do a high-pass filter on the acceleration to get rid of any dc component before integrating it.

=====================================
(2B)+(2B)' ?
 
If for some reason you are doing integration in the frequency domain, then the filtering is pretty easy in the frequency domain.

It is something similar to setting the lower frequency components to zero. Except don't cut the magnitudes off sharply. Instead, multiply the fourier coefficients by some function which is 0 at zero frequency and then changes smoothly from 0 to 1 around the transition frequency. This avoids Gibbs-effect related phenomena, which could cause ringing in your time domain.

=====================================
(2B)+(2B)' ?
 
I have done this for real quite a lot in the past. The best way to do it is to use a cosine taper window at the beginning and end of the signal - then do the integration in the frequency domain. You will lose fidelity of the integrated data in the region of the tapers but the rest will be good.

Numerical time domain integration always leads to tears...

M

--
Dr Michael F Platten
 
"always leads to tears"

Been there, done that. Trying to estimate transient clearances betwteen components using acceleromters on each. Plasticene was a lot better.

- Steve
 
So then there would be two stages of smooth windowing to avoid multiplying by square-corner function:

1 – In time domain: Multiply time waveform by smooth envelope function in time domain prior to FFT (for example Hanning)

2 – In frequency domain: Multiply FFT by smooth HP filter function, perhaps something like
1-(1/[1+<w/wc>^<2*n>]) where n is even integer.. where wc is cuttoff and 2n is even integer... higher gives sharper cutoff.

Then of course multiply by (1/(j*w)) and iFFT


=====================================
(2B)+(2B)' ?
 
Hmm. If you use a Hann window then your resulting acceleration signal will be Hann window shaped (ish). If you have a long signal, then just taper the ends with a 1/2 cosine shape and leave the middle bit flat. Just make sure that the period of the cosine taper is much less than any of your frequencies of interest.

Of course windowing of any kind is a non-linear process. The precision way which I used (though not available except in controlled circumstances) is to make your signals naturally leakage free. You can do this by gradually ramping up the excitation, then gradually ramping it down at the end. Make sure that you carry on recording the responses until they die away completely.

M

--
Dr Michael F Platten
 
You're right, we should'n't apply Hanning to a window when we intend to do iFFT and examine time domain behavior of signal or it's integral. I see better what you were describing is a time window which provides compromise between windowing and preserving the center of the window.



=====================================
(2B)+(2B)' ?
 
Looks like a ramp to me. That would be from integrating a simple negative offset. Is there an obvious offset at the beginning or end of the accel data that you could subtract (or add, it's negative)?
 
I doubt the end offset is doing that! but yes, removing the starting offset is the quick and easy solution. In one case I removed the first moment as well, ie end up with first and last point at y=0. I can't remember why I did it but that may come in handy.



Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Thanks for the help guys, but the input is just a regular sin wave that I'm making noisier and nosier. I've called it acceleration for now before I actually start putting in data from the source. I don't think a high pass filter would help in this situation because after the FFT the results (ie the blue line) isn't cyclic. I've been playing around with it and by changing the variable "et" on line 10 of the attached code to an even integer, the plots work out much nicer. I'm assuming the FFT algorithm doesn't like odd integers?
 
 http://files.engineering.com/getfile.aspx?folder=f34b097b-959f-455a-b3c1-b995795d06eb&file=OMEGAARITHMETIC_tochange.m
I didn't look closely but it seems you must have introduced dc in your processing.

You might try your entire process (FFT, iFFT) excluding the 1/(2*pi*f*1i) integration to see if you get back what you started with. I'm betting you won't.

You probably already figured that out. Sorry if I'm stating the obvious.

=====================================
(2B)+(2B)' ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top