Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock 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

Status
Not open for further replies.

MarkTsu

Mechanical
Apr 9, 2011
8
Hello, this is my first post.

I've searched and seen some similar quesitons in the past, but thus far I'm still stuck, so I'll ask.

I'm trying to convert acceleration results into velocity using
"Omega Arithmetic". The Matlab code I wrote is something like this:

AccelFreqDomain=fft(AccelTimeSignal);
%n is the # of samples
%dt is the sampling rate
freq=(-n/2:n/2)/(n*dt) ;

VelocityFreqDomain=AccelFreqDomain./(2*pi*freq*1i);
VelocityTimeDomain=ifft(VelocityFreqDomain);
plot(VelocityTimeDomain);
hold on
plot(AccelerationTimeDomain);

When I plot the accel. and the velocity on the same graph, the phase shift is correct. When I change the amplitude of the input acceleration, the amplitude of the velocity output changes as expected. The problem is, if I change the input acceleration frequency, the output velocity amplitude remains the same, when I would expect it to change.

Any idea what I'm doing wrong?

Once I get the program responding logically, I'll probalby have some more questions about units.

Thanks for your time,
Mark

 
Replies continue below

Recommended for you

The check to see if you have done it right is to look at the complex part of velocity time domain signal (I see you have a 'real' command in the plot line). If the imaginary part is greater than machine precision then you have done it wrong.
To get a real number in the time domain, the FFT values for the negative frequencies must be the conjugate of their positive values.

M

--
Dr Michael F Platten
 
My program has been working well. Thanks again for all the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor