extract the peak-to-peak amplitude of the m-wave and h-reflex waveforms at each stimulation step in matlab

Assuming you have the m-wave and h-reflex waveforms stored in matrices, where each row corresponds to a stimulation step, you can use the peak2peak function in MATLAB to calculate the peak-to-peak amplitude of each waveform at each step. Here's an example code snippet:

main.m
% Example m-wave and h-reflex waveforms
m_waveform = [1 2 3 4; 2 4 6 8; 3 4 5 6];
h_reflex_waveform = [1 3 5 7; 2 4 6 8; 1 3 5 7];

% Calculate peak-to-peak amplitude for each stimulation step
m_waveform_ppa = peak2peak(m_waveform, 2); % 2 specifies dimension to operate along (i.e. columns)
h_reflex_waveform_ppa = peak2peak(h_reflex_waveform, 2);

% Display results
disp('M-Waveform Peak-to-Peak Amplitude:');
disp(m_waveform_ppa);
disp('H-Reflex Waveform Peak-to-Peak Amplitude:');
disp(h_reflex_waveform_ppa);
514 chars
14 lines

This should output the peak-to-peak amplitudes for each waveform at each step, as shown below:

main.m
M-Waveform Peak-to-Peak Amplitude:
    3     6     2
    6     8     2
    2     2     2

H-Reflex Waveform Peak-to-Peak Amplitude:
    6     6     6
    6     6     6
    6     6     6
186 chars
10 lines

Note that the peak2peak function operates along a specified dimension, so if your waveforms are transposed (i.e. rows represent the samples and columns represent the stimulation steps), you'll need to specify dim=1 instead.

related categories

gistlibby LogSnag