Home > RPSstuff > gmean.m

gmean

PURPOSE ^

GMEAN just like mean, except that it skips over bad points

SYNOPSIS ^

function xnew=gmean(x)

DESCRIPTION ^

 GMEAN  just like mean, except that it skips over bad points
  Usage:  xnew=gmean(x);
             x can be a vector or matrix

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xnew=gmean(x)
0002 % GMEAN  just like mean, except that it skips over bad points
0003 %  Usage:  xnew=gmean(x);
0004 %             x can be a vector or matrix
0005 [imax,jmax]=size(x);
0006 if(imax==1),
0007   imax=jmax;
0008   jmax=1;
0009   x=x.';
0010 end
0011 for j=1:jmax
0012        good=find(finite(x(:,j)));
0013        if length(good)>0
0014           xnew(j)=mean(x(good,j));
0015        else
0016           xnew(j)=NaN;
0017        end
0018 end

Generated on Wed 30-Nov-2005 14:45:02 by m2html © 2003