- 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.
- 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.
- 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.
Separating Data of Exercises
    7 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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
I really appreciate your help
0 Commenti
Risposte (1)
  VINAYAK LUHA
      
 il 8 Gen 2024
        
      Modificato: VINAYAK LUHA
      
 il 8 Gen 2024
  
      Hi Muhammad,
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:
Additionally you may refer to the following article to know more about the findpeak function 
Hope this answers your query.
Regards,
Vinayak Luha
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

