Home > NoiseTools > nt_bsplot_old.m

nt_bsplot_old

PURPOSE ^

nt_bsplot(x,sds,style,abscissa,zeroflag,rmsflag) - plot average with bootstrap standard deviation

SYNOPSIS ^

function nt_bsplot(x,band,style,abscissa,zeroflag,rmsflag)

DESCRIPTION ^

nt_bsplot(x,sds,style,abscissa,zeroflag,rmsflag) - plot average with bootstrap standard deviation

  x: data to plot (time * trials, or time * 1 * trials)
  band: width of band to plot in standard deviations (default: 2)
  style: 'zerobased' (default) or 'meanbased'
  abscissa: use this vector as plot's abscissa (as in 'plot(abscissa,x)' )
  zeroflag: if 1 draw zero line (default: 1)
  rmsflag: if 1 use RMS instead of mean (default==0)

  Bootstrap uses N=1000 iterations.
 
  Example:
    nt_bsplot(x)
  where x is time*trials will plot the average of x over trials, together
  with +/- 2SDs of the bootstrap resampling.

 NoiseTools.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function nt_bsplot(x,band,style,abscissa,zeroflag,rmsflag)
0002 %nt_bsplot(x,sds,style,abscissa,zeroflag,rmsflag) - plot average with bootstrap standard deviation
0003 %
0004 %  x: data to plot (time * trials, or time * 1 * trials)
0005 %  band: width of band to plot in standard deviations (default: 2)
0006 %  style: 'zerobased' (default) or 'meanbased'
0007 %  abscissa: use this vector as plot's abscissa (as in 'plot(abscissa,x)' )
0008 %  zeroflag: if 1 draw zero line (default: 1)
0009 %  rmsflag: if 1 use RMS instead of mean (default==0)
0010 %
0011 %  Bootstrap uses N=1000 iterations.
0012 %
0013 %  Example:
0014 %    nt_bsplot(x)
0015 %  where x is time*trials will plot the average of x over trials, together
0016 %  with +/- 2SDs of the bootstrap resampling.
0017 %
0018 % NoiseTools.
0019 
0020 if nargin<6 || isempty(rmsflag) ; rmsflag=0; end
0021 if nargin<5 || isempty(zeroflag) ; zeroflag=1; end
0022 if nargin<4; abscissa=[]; end
0023 if nargin<3 || isempty(style); style='zerobased'; end
0024 if nargin<2 || isempty(band); band=2; end
0025 
0026 x=squeeze(x);
0027 if ndims(x)>2; error('X should have at most 2 non-singleton dimensions'); end
0028 [m,n]=size(x);
0029 if n<2; error('bootstrap resampling requires more than 1 column'); end
0030 if isempty(abscissa); abscissa=1:m; end
0031 if numel(abscissa) ~= size(x,1); error('abscissa should be same size as x'); end
0032 
0033 if rmsflag
0034     [a,b]=nt_bsrms(x);
0035 else
0036     N=1000;
0037     [a,b]=nt_bsmean(x,N);
0038 end
0039 b=b*band;
0040 
0041 
0042 if strcmp(style,'zerobased');
0043     Y=[b;-flipud(b)]';
0044 elseif strcmp(style,'meanbased');
0045     Y=[b+a;flipud(-b+a)]';
0046 else
0047     error('!');
0048 end
0049 abscissa=abscissa(:);
0050 X=[abscissa;flipud(abscissa)];
0051 C=0.7*[1 1 1];
0052 fill(X,Y,C,'edgecolor','none');
0053 hold on;
0054 plot(abscissa,a*0,'k');
0055 plot(abscissa,a, 'b'); 
0056 hold off
0057 
0058 % return
0059 %
0060 % abscissa2=linspace(min(abscissa),max(abscissa),m*2);
0061 % plot(abscissa2,b,'g');
0062 % c=get(gca,'children'); set(c(1),'color',[.7 .7 .7])
0063 % hold on;
0064 % plot(abscissa,a,'b');
0065 % if zeroflag;
0066 %     plot(abscissa,0*a,'k');
0067 %     c=get(gca,'children'); set(c(1),'color',[.5 .5 .5])
0068 % end
0069 % %set(gca,'xlim',[1 m])
0070 % hold off

Generated on Wed 05-Jul-2017 12:25:43 by m2html © 2005