# Separating Data of Exercises

2 vues (au cours des 30 derniers jours)
Hello everyone!
I have data for CoM (Center of Mass) movement of a subject while performing an exercises (see attachment). I'd like to sort it into each repetitions (e.g., repetitions 1, 2 ... 5). I tried to use peak and min values to determine each repetitions but as I used min function it only showed one value. So, far I can only cut from the start until the end of the exercises. Here's a part of my code:
if (string(filenames{j})) == 'Bridge_2_0001';
Data.CoM.(filenames{j}) = Data.Markers.(filenames{j})(4,3,:);
[pks.(filenames{j}), loc.(filenames{j}), wid.(filenames{j})] = findpeaks(Data.CoM.(filenames{j})(1,:), 'MinPeakDistance', 100, 'MinPeakDistance', 100, 'Annotate', 'extents');
Cut.(filenames{j}) = loc.(filenames{j})(:,2):loc.(filenames{j})(:,14);
elseif (string(filenames{j})) == 'Lunge_R_0001';
Data.CoM.(filenames{j}) = sum(Data.Markers.(filenames{j})(1:4,3,:))./4;
[pks.(filenames{j}), loc.(filenames{j}), wid.(filenames{j})] = findpeaks(-Data.CoM.(filenames{j})(1,:), 'MinPeakDistance', 100, 'MinPeakDistance', 100, 'Annotate', 'extents');
Cut.(filenames{j}) = loc.(filenames{j})(:,1):loc.(filenames{j})(:,10);
elseif (string(filenames{j})) == 'Lunge_L_0001';
Data.CoM.(filenames{j}) = sum(Data.Markers.(filenames{j})(1:4,3,:))./4;
[pks.(filenames{j}), loc.(filenames{j}), wid.(filenames{j})] = findpeaks(-Data.CoM.(filenames{j})(1,:), 'MinPeakDistance', 100, 'MinPeakDistance', 100, 'Annotate', 'extents');
Cut.(filenames{j}) = loc.(filenames{j})(:,1):loc.(filenames{j})(:,12);
else
Data.CoM.(filenames{j}) = sum(Data.Markers.(filenames{j})(11:14,3,:))./4;
[pks.(filenames{j}), loc.(filenames{j}), wid.(filenames{j})] = findpeaks(-Data.CoM.(filenames{j})(1,:), 'MinPeakDistance', 100, 'MinPeakDistance', 100, 'Annotate', 'extents');
Cut.(filenames{j}) = loc.(filenames{j})(:,2):loc.(filenames{j})(1,end);
end
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

VINAYAK LUHA le 8 Jan 2024
Modifié(e) : VINAYAK LUHA le 8 Jan 2024
I understand that you want to segment a time series data of Center of Mass (CoM) movement from an exercise routine into individual repetitions in MATLAB.
Here are the steps to accomplish your objective:
1. Use the MATLAB "findpeaks" function to identify peaks, and invert the signal (multiply by -1) to find troughs using the same function. This will give you the start and end points of each repetition.
2. It's critical to adjust parameters like "MinPeakDistance", "MinPeakHeight", and "MinPeakProminence" to suit the specific traits of your CoM dataset for precise peak and trough detection.
3. With the peak and trough locations identified, you can then divide the dataset into individual repetitions. Typically, a repetition starts at a trough and concludes at the following peak, or the other way around.
Additionally you may refer to the following article to know more about the findpeak function
Regards,
Vinayak Luha
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Descriptive Statistics 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