Numerically integrating acceleration properly
조회 수: 4 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Star Strider
2016년 7월 28일
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
Star Strider
2016년 7월 29일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!