smoothing data

조회 수: 4 (최근 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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Circuit Envelope Simulation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by