- Get the spectrogram of the first row, plot it.
- Play with the parameters for 5 minutes to make sure they make some sense to you
- Get the spectrogram of the second row, plot it
- Average the two spectrograms, plot the average
- Create a 3-D matrix which is [n,m,k] big, n x m are going to be the size of a single spectrogam and k is going to be the number of trials
- Loop over trials, store each trial's spectrogram in your matrix
- Take the mean over the third dimension (mean(myspecmatrix,3)) and plot it

- if you call spectrogram with no outputs, it will plot. But the default parameters are unlikely to be good for neural data (8 bins), and spectrogram's plot is (oddly) frequency on the x axis and time on the y axis, which will probably be backwards for you
- You'll want to specify all of the inputs for spectrogram: X is the signal (a trial in your case); WINDOW is the size of the bin that's going into the spectrum estimate, maybe you want a second or so here to start (really depends on what you're looking for), bigger bin means more frequency resolution but less time resolution; NOVERLAP is how much that window will slide by, maybe start with something 80% of WINDOW; NFFT can be difficult, it's the number of points used in the Fourier transform, you can use [ ] to let MATLAB pick but note that this will determine the size of your output; Fs is your sampling rate.
- If you do [s,y,x] = spectrogram(...), then you can do imagesc(x,y,log10(abs(s))) to plot it. Adjusting the axes clim property is a good way to clean up the noise in this plot.