How do i make a routine that will iteratively alter the strength a moving average filter?

The context of the question is this: I have a set of data collected by a moving arm that stops at certain locations. I have the velocity of the arm during the duration of the movement, which is the data that i am trying to filter using a moving average filter. I have to vary the strength of the filter until its possible to determine the coordinates of the points where the arm stopped moving. I have no idea how to get around this. can anyone help?

Answers (1)

Just find out where the velocity is zero, or less than some small number. Then use those indexes to get the x and y locations.
stoppedIndexes = velocity < 0.1; % or whatever.
xStopped = x(stoppedIndexes);
yStopped = y(stoppedIndexes);
zStopped = z(stoppedIndexes);
If it's stopped for a number of contiguous indexes, and you want just one, then find the centroid of each stopped group using regionprops().
labeled = bwlabel(stoppedIndexes);
props = regionprops(labeled, 'Centroid'); % Returns a structure array of centroids.

This question is closed.

Asked:

on 10 Apr 2017

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!