annotate utilities/UTIL_cascadePlot.m @ 38:c2204b18f4a2 tip

End nov big change
author Ray Meddis <rmeddis@essex.ac.uk>
date Mon, 28 Nov 2011 13:34:28 +0000
parents
children
rev   line source
rmeddis@38 1 function UTIL_cascadePlot(toPlot, colValues)
rmeddis@38 2 % % useful code
rmeddis@38 3 [nChannels nLags]=size(toPlot);
rmeddis@38 4
rmeddis@38 5 % cunning code to represent channels as parallel lines
rmeddis@38 6 [nRows nCols]=size(toPlot);
rmeddis@38 7 if nChannels<2
rmeddis@38 8 error('UTIL_cascadePlot: only one row found')
rmeddis@38 9 end
rmeddis@38 10
rmeddis@38 11 % a is the height to be added to each channel
rmeddis@38 12 a=max(max(toPlot))*(0:nRows-1)';
rmeddis@38 13
rmeddis@38 14 % peakGain emphasises the peak height
rmeddis@38 15 % peaks can be higher than the space between channels
rmeddis@38 16 peakGain=10;
rmeddis@38 17 x=peakGain*toPlot+repmat(a,1,nCols);
rmeddis@38 18 x=nRows*x/max(max(x));
rmeddis@38 19
rmeddis@38 20 for row=1:nRows-1
rmeddis@38 21 x(row,:)=min(x(row,:), x(row+1,:));
rmeddis@38 22 end
rmeddis@38 23
rmeddis@38 24 plot(colValues, x','k')
rmeddis@38 25 ylim([0 nRows])
rmeddis@38 26