plotsig

PURPOSE ^

Function to plot C where it is higher than a threshold sig

SYNOPSIS ^

function plotsig(C,sig,t,f)

DESCRIPTION ^

 Function to plot C where it is higher than a threshold sig
 useful for plotting coherence
 Usage: plotsig(C,sig,t,f)
 Inputs:
 C: input array t x f. If vector, then as row vector
 sig: significance level
 t: t axis grid for plot
 f: f axis grid for plot.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotsig(C,sig,t,f)
0002 % Function to plot C where it is higher than a threshold sig
0003 % useful for plotting coherence
0004 % Usage: plotsig(C,sig,t,f)
0005 % Inputs:
0006 % C: input array t x f. If vector, then as row vector
0007 % sig: significance level
0008 % t: t axis grid for plot
0009 % f: f axis grid for plot.
0010 if nargin < 4; error('Need all arguments'); end;
0011 [T,F]=size(C);
0012 if F==1; error('C needs to be a row vector'); end;
0013 if T~=length(t) || F~=length(f);
0014     error('frequency and/or time axes are incompatible with data'); 
0015 end;
0016 if T==1;
0017     dim=max(T,F);
0018     C=C(:);
0019     mask=zeros(dim,1);
0020     indx=find(C>sig);
0021     mask(indx)=1;
0022     plot(f,mask.*C); 
0023     xlabel('f'); ylabel('|C|');
0024 else
0025     mask=zeros(T,F);
0026     for n=1:length(t);
0027         for m=1:length(f);
0028            if C(n,m)>sig
0029               mask(n,m)=1;
0030            end;
0031         end;
0032     end;
0033     imagesc(t,f,(mask.*C)'); axis xy; colorbar
0034     xlabel('t'); ylabel('f');
0035 end;

Generated on Tue 28-Mar-2006 14:37:41 by m2html © 2003