过滤旋转加速度(适合用于卡尔曼滤波器?)

问题描述:

我工作,其中,杆在一端连接到旋转轴的一个项目。所以,当轴从0至〜100度向后的往复(在xy平面内)旋转时,也是如此杆。予装一个3轴加速度计,在移动杆的端部,并予测从旋转中心加速度计的距离(即,杆的长度)是约38厘米。我收集了大量的数据,但我需要帮助找到对其进行过滤的最佳方法。首先,这里的原始数据的一个情节:

I'm working on a project in which a rod is attached at one end to a rotating shaft. So, as the shaft rotates from 0 to ~100 degrees back-and-forth (in the xy plane), so does the rod. I mounted a 3-axis accelerometer at the end of the moving rod, and I measured the distance of the accelerometer from the center of rotation (i.e., the length of the rod) to be about 38 cm. I have collected a lot of data, but I'm in need of help to find the best method to filter it. First, here's a plot of the raw data:

我认为数据是有道理的:如果它的斜坡向上,再然后我想在这一点上的加速度应该是线性增长,然后当它的斜坡下来,就应该线性减小。如果它不断移动,加速性能将〜为零。记住,虽然,有时速度的变化(更高)从一个试用到其他。在这种情况下,有〜120试验或运动/扫描,在148赫兹的数据采样。

I think the data makes sense: if it's ramping up, then then I think at that point the acceleration should be linearly increasing, and then when it's ramping down, it should linearly decrease. If its moving constantly, the acceleration will be ~zero. Keep in mind though that sometimes the speed changes (is higher) from one "trial" to the other. In this case, there were ~120 "trials" or movements/sweeps, data sampled at 148 Hz.

有关过滤,我已经尝试了低通滤波器,然后一个指数递减均线,并且两个地块都不要太热。虽然我不擅长跨preting这些:这里是我得到的编码电源频率图时:

For filtering, I've tried a low pass filter and then an exponentially decreasing moving average, and both plots weren't too hot. And although I'm not good at interpreting these: here is what I got when coding a power frequency plot:

我希望能得到帮助,这里是,获得一个很好的方法,通过它我可以过滤这些数据。有一件事是保持未来再升一次次(尤其是在这个网站)是卡尔曼滤波器。虽然还有很多code网上,有助于MATLAB实现这些,我一直没能真正理解它的伟大,并因此忽视,包括在这里我就可以工作。那么,卡尔曼滤波器适合这里,旋转加速度?如果是这样,有人可以帮助我实现一个MATLAB和跨preT呢?有什么我没有看到,可能是一样好/最好是相对简单?

What I was hoping to get help with here is, attain a really good method by which I can filter this data. The one thing that keeps coming up again time and time again (especially on this site) is the Kalman filter. While there's lots of code online that helps implementing these in MATLAB, I haven't been able to actually understand it that great, and therefore neglect to include my work on it here. So, is a kalman filter appropriate here, for rotational acceleration? If so, can someone help me implement one in matlab and interpret it? Is there something I'm not seeing that may be just as good/better that is relatively simple?

下面是我说的数据。望着它更加紧密地/放大提供了更好的AP preciation对什么在运动回事,我想:

Here's the data I'm talking about. Looking at it more closely/zooming in gives a better appreciation for what's going on in the movement, I think:

http://cl.ly/433B1h3m1L0t?_ga=1.81885205.2093327149.1426657579

编辑:好了,下面是加速度计采集两个relavent尺寸的情节。我忽略了包括上下尺寸为加速度计显示接近恒定〜1个G,所以我认为其安全地说,它没有捕捉太多旋转运动。红色是我所相信的是向心力成分,蓝色是切线。我不知道如何将它们结合起来,虽然,这就是为什么我(也许错误地?)忽视了它在我的岗位。

OK, here is the plot of both relavent dimensions collected from the accelerometer. I am neglecting to include the up and down dimension as the accelerometer shows a near constant ~1 G, so I think its safe to say its not capturing much rotational motion. Red is what I believe is the centripetal component, and blue is tangential. I have no idea how to combine them though, which is why I (maybe wrongfully?) ignored it in my post.

和这里是另一个维度的数据:

And here is the data for the other dimension:

http://cl.ly/1u133033182V?_ga=1.74069905.2093327149.1426657579

忘了卡尔曼滤波器,见注,为原因的回答结束。

Forget the Kalman filter, see the note at the end of the answer for the reason why.

使用简单的移动平均滤波器(像我向您展示了此前的回应,如果我还记得的),它在本质上是低通滤波器:

Using a simple moving average filter (like I showed you on an earlier reply if i recall) which is in essence a low-pass filter :

n = 30 ; %// length of the filter
kernel = ones(1,n)./n ;
ysm = filter( kernel , 1 , flipud(filter( kernel , 1 , flipud(y) )) ) ; 
%// assuming your data "y" are in COLUMN (otherwise change 'flipud' to 'fliplr')

注意:如果你有机会获得曲线拟合工具箱,你可以简单地使用: YS =光滑(Y,30); 来得到几乎相同的结果。

note: if you have access to the curvefit toolbox, you can simply use: ys = smooth(y,30) ; to get nearly the same result.

我得到: 曾经缩放如下所示:

I get: which once zoomed look like:

您可以用参数玩 N 来增加或减少平滑。

You can play with the parameter n to increase or decrease the smoothing.

灰色的信号是你的原始信号。我强烈怀疑噪声尖峰你得到只是由于你的棒的振动。 (取决于你的杖的比例长度/横截面,你可以在你的38厘米杆端得到显著振动,这些振动将围绕主载波信号振荡的形状,这肯定看起来像我所看到的你的信号)。

The gray signal is your original signal. I strongly suspect that the noise spikes you are getting are just due to the vibrations of your rod. (depending on the ratio length/cross section of your rod, you can get significant vibrations at the end of your 38 cm rod. These vibrations will take the shape of oscillations around the main carrier signal, which definitely look like what I am seeing in your signal).

请注意: 卡尔曼滤波器是矫枉过正的方式做噪声数据的一个简单的过滤。当你要计算的值(一个位置,如果我按照你的榜样)的基础上有些吵测量卡尔曼滤波器,但细化计算,卡尔曼滤波器也将使用位置的基础上,$一个prediction p $ pvious状态(位置)和惯性数据(有多快你旋转为例)。对于prediction你需要一个模式系统的行为,你似乎并不具备。

Note: The Kalman filter is way overkill to do a simple filtering of noisy data. Kalman filter is used when you want to calculate a value (a position if I follow your example) based on some noisy measurement, but to refine the calculations, the Kalman filter will also use a prediction of the position based on the previous state (position) and the inertial data (how fast you were rotating for example). For that prediction you need a "model" of the behavior of your system, which you do not seem to have.

在你的情况下,则需要计算看到由基于所述轴的(已知或理论上)旋转速度在任何时间点的加速度的加速度时,ACCELL到旋转中心的距离,和可能使其更precise,你的杆的主振动模式的动态模型。然后对于每个步骤,比较,为实际测量......似乎有点沉重了,你的情况。

In your case, you would need to calculate the acceleration seen by the accelerometer based on the (known or theoretical) rotation speed of the shaft at any point of time, the distance of the accell to the center of rotation, and probably to make it more precise, a dynamic model of the main vibration modes of your rod. Then for each step, compare that to the actual measurement... seems a bit heavy for your case.

看快速数字解释这个Wikipedia条目卡尔曼滤波过程:卡尔曼滤波,如果你想了解更往下看。

Look at the quick figure explaining the Kalman filter process in this wikipedia entry : Kalman filter, and read on if you want to understand it more.