smoothing data

4 vues (au cours des 30 derniers jours)
Paul
Paul le 29 Août 2011
Commenté : Kh zaa le 16 Sep 2018
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.

Réponses (2)

Veera Kanmani
Veera Kanmani le 19 Avr 2018
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 le 19 Avr 2018

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 commentaire
Kh zaa
Kh zaa le 16 Sep 2018
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Circuit Envelope Simulation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by