Here's an example MATLAB code to extract the peak-to-peak amplitude of the m-wave and h-reflex at each stimulation step and create a graph of raw units in MATLAB:
main.m1407 chars42 lines
This code assumes that your data is stored in a variable named data
and that each element of data
corresponds to a single time point. You can replace the filename and variable names as necessary.
The code first defines the constants, including the sampling frequency, stimulus timing parameters, and number of stimulation steps. It then preallocates the output variables mwave_pp
and h_reflex_pp
as arrays of zeros.
The code then loops through each stimulation step and extracts the prestimulus and response data for each window. It then calculates the peak-to-peak amplitude of the response for both the m-wave and h-reflex.
Finally, the code creates a plot of the peak-to-peak amplitudes for each stimulation step using the plot
function. The x-axis shows the stimulation step number, while the y-axis shows the peak-to-peak amplitude in raw units. The code also adds axis labels, a legend, and a title to the plot.
gistlibby LogSnag