Topics Map > Resources for collaborators
General plotting scripts
Overview and steps before plotting
The end result of data analysis is a file
dataVals.mat. dataVals holds data about each trial's pitch, f1, f2, amplitude, duration, and metadata. See here for our default data analysis process.
For plotting, we use dataVals to make a file whose name includes "fmtMatrix". fmtMatrix becomes the basis of the plotting scripts.
Generate fmtMatrix for a single subject
Make a copy of the function
free-speech/templates/modelExpt/gen_fmtMatrix_modelExpt.m . Rename the copy and replace "modelExpt" with the name of your experiment. Move it to the folder where you store code for your experiment.
This function will eventually generate a fmtMatrix file for a single participant. But, you need to change some things in the code. Search for "ACTION NEEDED" and make changes as directed. In short, you must decide how you want to group certain types of trials together.
To run the function, navigate in Matlab to the folder with your dataVals.mat and expt.mat file, then execute the function with no input arguments.
The name of the fmtMatrix output file is deterministic, based on the names of the conditions and groupings. If the name would be very long, the helper function
gen_fmtMatrixByCond may prompt you to rename it.
Plot fmtMatrix from a single subject
free-speech/plotting/plot_fmtMatrix.m takes the fmtMatrix file from the previous step and plots it. The third input argument "toPlot" determines which component of fmtMatrix will be plotted. Options include:
|Field name in fmtMatrix
|rawf1 or rawf2
|Raw formant values, averaged among all trials in a group
|diff1 or diff2
|The F1 or F2 difference (in mels) between the baseline and experimental condition
|normDiff1 or normDiff2
|The F1 or F2 normalized difference between baseline and experimental conditions
|In 2-dimensional space where F1 and F2 make up each dimension, the distance between baseline and experimental conditions
|percdiff1 or percdiff2
|Percent difference F1 or F2
|Percent difference in 2-dimensional space, where F1 and F2 make up each dimension
|fracdiff1 or fracdiff2
|Fractional difference F1 or F2
|proj, percproj, effproj, effdist
|Dot product projection and efficiency
Generating fmtMatrix and plotting data for multiple subjects
After you have created individual fmtMatrix files, use
free-speech/speech/gen_fmtMatrix_crossSubj.m to generate a cross-subject fmtMatrix file.
plot_fmtMatrix_crossSubj to plot it.