function npeaks = FindNPeaks(model,mn,mx)
arg = [mn : (mx-mn)/1e4 : mx];
narg=length(arg);
thispdf = BinomPDF(model,arg);
slope=0;prevslope=0;
npeaks=0;
for j=2:narg
   if (thispdf(j)>thispdf(j-1)) 
      slope=1;
   elseif (thispdf(j)==thispdf(j-1)) 
      slope=0;
   elseif (thispdf(j)<thispdf(j-1)) 
      slope=-1;
   end
   if (slope==-1 & prevslope==1) | (slope==0 & prevslope==1) | (slope==0 & prevslope==-1)
      npeaks = npeaks+1;
   end
   prevslope=slope;
end
