Clear Filters
Clear Filters

Numerically integrating acceleration properly

3 views (last 30 days)
I'm doing some vibration analysis and I have some acceleration data that I'd like to convert to position. Using cumtrapz doesn't actually give me the correct velocity and position signal - they are shifted up. Take the following code for example:
x=0:.01:2*pi;
y1=sin(2*x);
y2=cumtrapz(x,y1);
y3=-cos(2*x)/2;
plot(x, [y1; y2; y3])
I know y3 is the true velocity signal but the cumtrapz is giving me a shifted up signal. It is in fact the sum but is not in fact physically correct. I can simply correct for by subtracting the max. But this wouldn't be true for more varying signals. like the following:
x=0:.01:2*pi;
y1=sin(2*x^2);
y2=cumtrapz(x,y1);
plot(x, [y1; y2-max(y2)])
you'll see with that plot the the velocity is mostly positive which means the position will diverge. This is not physically possible with this system. So obviously this correction is different for every signal. So how do i properly correct for this?

Answers (1)

Star Strider
Star Strider on 28 Jul 2016
Your maths may be a bit off. Try this:
x=0:.01:2*pi;
y1=sin(2*x);
y2=cumtrapz(x,y1);
y3=cumtrapz(x,y2);
plot(x,y1, x,y2, x,y3)
because:
syms x
y1 = sin(2*x)
y2 = int(y1,x)
y3 = int(y2,x)
y1 =
sin(2*x)
y2 =
sin(x)^2
y3 =
x/2 - sin(2*x)/4
I believe that’s what you want to do.
  2 Comments
STEPHEN BARRETT
STEPHEN BARRETT on 29 Jul 2016
This has the same problem. the first integrated function, the velocity is always positive in what you gave. which means the position will go off to infinity. If this were a mass spring oscillator, which it is a model for. Then the position, the red signal, will going off to infinity. this is not possible in this case here.
Star Strider
Star Strider on 29 Jul 2016
A spring-mass-damper system is described by a second-order differential equation, so when it is reduced to two first-order differential equations, the outputs will be only position and velocity. There is no acceleration term. It would be necessary to differentiate the velocity to get acceleration.
I would go back and check your instrumentation. (I don’t know what you’re doing, so I can’t.) Are you certain you are recording acceleration rather than velocity or position? Even if you’re using an accelerometer as your sensor, your instrumentation may be integrating it to velocity or position.
That’s the only thing I can think of. The maths here are correct.

Sign in to comment.

Categories

Find more on Physics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!