Here is a sample MATLAB code that shows how to extract the peak-to-peak amplitude of the m-wave and h-reflex waveforms at each stimulation step with filtering and generating the variable in MATLAB:
main.m1736 chars41 lines
Some additional details about the code:
emg_data
variable contains the raw EMG data as a column vector.stim_onset_loc
variable corresponds to the sample number at which the stimulation starts.n_stim_steps
variable is the number of stimulation steps in the experiment.findpeaks
function is used to find the local maxima and minima in the smoothed EMG signal.table
function is used to create a new variable peak_to_peak
that contains the peak-to-peak amplitude values for each waveform, which can be used for further analysis.gistlibby LogSnag