smoothing data

2 次查看(过去 30 天)
Paul
Paul 2011-8-29
评论: Kh zaa 2018-9-16
Hi,
I have positional data captured from an LED tracker in separate matrices for x and y for series of trials. Each "trial" corresponds to one of the columns of the matrices. The columns for different trials are different lengths, depending on the size of the movement, with the remaining vector space being 0. I am looking at velocity profiles above a certain threshold speed. I combined my x and y data into a positional matrix, and took the derivative to get my velocity matrix. When I do this, the velocity profile is very noisy, so I tried to smooth it using 'loess.' My code as of now looks like this
for dind =1:length(x1s);
posdata(:,dind) = smooth(sqrt(x1s(:,dind).^2+y1s(:,dind).^2),.1,'loess');
veldata(:,dind)=(diff(posdata(:,dind)));
end
The problem that I am having is that my vector for posdata and veldata are both longer than the raw x1s and y1s data, Am I misunderstanding how "smooth" works? Increasing the span increases size of the posdata and veldata vectors, so I am sure it is related to the smoothing.

回答(2 个)

Veera Kanmani
Veera Kanmani 2018-4-19
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0ahUKEwjizbanicbaAhULrI8KHQ9GChkQFgguMAI&url=https%3A%2F%2Fwww.mathworks.com%2Fhelp%2Fcurvefit%2Fsmoothing-data.html&usg=AOvVaw2RRcc55HyaXc_RzoazOATF

Razvan Carbunescu
Razvan Carbunescu 2018-4-19

The issue in your code is the fact that veldata has 1 less elements than posdata because of the diff command. If you add a 0 to the front to signal this would match the sizes:

veldata(:,dind)=[0; diff(posdata(:,dind))];

For doing the outlier detection part you can use isoutlier. Also take a look at smoothdata for the smoothing step.

  1 个评论
Kh zaa
Kh zaa 2018-9-16
I use level-1 s-function in my simulink model. Measurements of 5 variables are collected in simulink and sent to s-function. In order to filter out some of measurements noise, i need to use the average of the snapshots received over a a time window (i.e. 2 second). how i can do that ? thanks

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by