Cutting and classifying accelerometer dataset into groups
2 次查看(过去 30 天)
显示 更早的评论
Hello, I am working with a dataset from a accelerometer measurement. The figure below shows an example of a vector of the total raw data from such a measurement.
My assigment is to classify these data into sedentary activity and dynamic activity in time. With peak detection I have managed to identity steps into the raw signal.
But now comes the part were I get stuck. The figure below shows an enlargement from the first figure. The area with the peaks displays dynamic activity and the area were are none is sedentary activity. Now I would like to make groups of this dataset so I can classify these areas. But I don't know how. I do have the X and Y coördinates from the peak detection but I don't know how to group all those X coördinates between those peaks (for example let's say the X coördinates from 2,65 *10^4 until 3,4 *10^4) into one group. If I have all those X coördinates it is also possible to calculate the length of such a period.
Thanks in advance, Shawn
0 个评论
回答(1 个)
Image Analyst
2016-11-1
Assuming the x coordinates are sorted and are actual index values, then to get the coordinates (indexes) between peaks, simply do this:
XIndexes = [1, sort(randi(99, 1, 10))] % Create sample data.
for k = 2 : length(XIndexes)
inBetweenX{k-1} = (XIndexes(k-1) + 1) : (XIndexes(k) - 1);
% Note: inBetweenX will not contain peak indexes themselves.
end
celldisp(inBetweenX)
I had to use a cell array because if the peaks are not uniformly spaced, then there could be different numbers of indexes between each pair of peaks.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!