cdf2prctile

PURPOSE ^

SYNOPSIS ^

function value=cdf2prctile(cdf,threshold)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function value=cdf2prctile(cdf,threshold)
0002 
0003 if isempty(find(cdf==threshold))==0
0004     value = min(find(cdf==threshold));
0005 else
0006     min_value = max(find(cdf < threshold));
0007     max_value = min(find(cdf > threshold));
0008     
0009     if isempty(max_value)==0
0010         if isempty(min_value)==0
0011             value = interp1([cdf(min_value) cdf(max_value)],[min_value max_value],threshold);
0012         elseif isempty(min_value)==1
0013             value = 0;
0014         end
0015     elseif isempty(max_value)==1
0016         if isempty(min_value)==0
0017             disp('Error : too high threshold!!');
0018             value = +Inf;
0019         elseif isempty(min_value)==1
0020             disp('Error : error in cdf input data!!');
0021             value = [];
0022         end
0023     end
0024 end 
0025

Generated on Sun 15-Aug-2004 22:13:10 by m2html © 2003