3 views (last 30 days)
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');
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.
Veera Kanmani on 19 Apr 2018
Razvan Carbunescu on 19 Apr 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: