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

Assuming you have stored the EMG signal in a matrix emg of size 600 x 21, you can follow these steps in Matlab to calculate the peak to peak amplitude of the M-wave and H-reflex:

  1. Split the EMG data into individual trials:

    main.m
    emg_trials = mat2cell(emg, 600, ones(1, 21));
    
    46 chars
    2 lines

    This will create a cell array where each element is a 600 x 1 column vector representing a single trial.

  2. Calculate the peak to peak amplitude of the M-wave for each trial:

    main.m
    mwave_pp = zeros(21, 1);
    for i = 1:21
        trial = emg_trials{i};
        mwave_pp(i) = max(trial) - min(trial);
    end
    
    112 chars
    6 lines

    This will create a column vector mwave_pp of size 21 x 1 containing the peak to peak amplitudes of the M-wave for each trial.

  3. Calculate the peak to peak amplitude of the H-reflex for each trial:

    main.m
    hreflex_pp = zeros(21, 1);
    for i = 1:21
        trial = emg_trials{i};
        mwave = max(trial);   % assumed that peak-to-peak amplitude of M-wave is stored in variable 'mwave'
        [~, min_idx] = min(trial);
        max_after_min = max(trial(min_idx:end));
        hreflex_pp(i) = abs(max_after_min - mwave);
    end
    
    299 chars
    9 lines

    This will create a column vector hreflex_pp of size 21 x 1 containing the peak to peak amplitudes of the H-reflex for each trial.

Note: Depending on your specific requirements, you may need to further process the data (e.g., remove baseline drift, filter the signal) before extracting the peak-to-peak amplitudes.

related categories

gistlibby LogSnag