calculate the peak to peak amplitude of the m-wave and h-reflex for an emg signal of 21 trials in matlab

Assuming that you have a 21-by-n matrix where each row represents a single trial of your EMG signal and n is the number of samples per trial, the peak-to-peak amplitude of the M-wave and H-reflex can be calculated as follows:

main.m
% Assume your data is stored in 'emg_data', a 21-by-n matrix
m_wave_ppa = zeros(1, 21); % pre-allocate a vector to store the M-wave PPA for each trial
h_reflex_ppa = zeros(1, 21); % pre-allocate a vector to store the H-reflex PPA for each trial

for i = 1 : 21 % loop through each trial
    trial_data = emg_data(i, :); % extract the EMG signal for the current trial
    m_wave_ppa(i) = max(trial_data) - min(trial_data); % calculate the M-wave PPA
    h_reflex_ppa(i) = max(trial_data(50 : 100)) - min(trial_data(50 : 100)); % calculate the H-reflex PPA (assuming the H-reflex is between 50 and 100 samples)
end
613 chars
10 lines

This code will create two vectors, m_wave_ppa and h_reflex_ppa, each with 21 elements, where each element represents the peak-to-peak amplitude of the M-wave and H-reflex for each trial, respectively. You can then calculate the mean and standard deviation of these vectors to obtain summary statistics.

related categories

gistlibby LogSnag