dividing signal into subsets
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have about 5 hours of the acceleration data for a particular user ( the collected data is real life data, which means I don't know what the user is doing at a particular time).
the dataset contains the time stamp in the first column and the acceleration data of 3 axes (X, Y, and Y) in the second, third, fourth columns respectively.
Time Stamp X Data Y Data Z Data
I would like to divide the data based on the user's activities (which is called Activity Recognition in order to make it easy for the classification).
For example, if the user is walking, extract his signal and store it in an array, if he is typing, the typing data will be extracted and store in another array, and so on. Hence, N number of arrays will be created, each will contain data of specific activity.
by the way, it doesn't matter what is the activity, it is more useful to extract the user's pattern for each part of the original signal ( pattern means, the user's signal looks consistent).
here is an example of the original signal for each axis
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163790/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163792/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163793/image.png)
As we can see, the original signal looks very noisy ( as the user do more than one activity at the same day) therefore, I'd like to divide the signal into subsets based on the user's activity.
Note, the highlighted part in attached pics was just an example of walking data from the original signal. I know it's walking data because as we can see it contains repetitive peaks that normally generated when the user is walking
I have attached a sample of my data
really appreciate any help.
Regards.
0 Kommentare
Antworten (2)
Image Analyst
am 5 Mai 2017
You forgot to attach any data so people can't try anything. I'd be tempted to filter the data with movstd() and then threshold. The parts you indicated should have low standard deviation. You'll need to play around with the window size parameter to find out what window size is best for your particular data.
Image Analyst
am 5 Mai 2017
See attached demo.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175929/image.png)
5 Kommentare
Image Analyst
am 6 Mai 2017
Most of your code should still work with the new version, unless you've used some function deprecated long ago. You can't stay stuck in the past forever so I'd encourage you to upgrade.
You don't need xticks() so you can just remove it.
You say "I don't want to smooth the signal now!" But that's the way to identify the sections you want. To extract your original signal, save it then extract it
xAccel = xAccel(1 : lastIndex+1);
originalSignal = xAccel; % Save original, non smoothed, non filtered signal.
% Smooth it.
kernel = ones(1001, 1) / 1001;
xAccel = conv(xAccel, kernel, 'same');
Then at the end, extract it
extractedSignal = originalSignal(startingIndex : startingIndex);
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!