]> Creatis software - CreaPhase.git/blob - octave_packages/nan-2.5.5/prctile.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nan-2.5.5 / prctile.m
1 function Q=prctile(Y,q,DIM)
2 % PRCTILE calculates the percentiles of histograms and sample arrays.  
3 % (its the same than PERCENTILE.M)
4 %
5 %  Q = prctile(Y,q)      
6 %  Q = prctile(Y,q,DIM)      
7 %     returns the q-th percentile along dimension DIM of sample array Y.
8 %     size(Q) is equal size(Y) except for dimension DIM which is size(Q,DIM)=length(Q)
9 %
10 %  Q = prctile(HIS,q)
11 %     returns the q-th percentile from the histogram HIS. 
12 %     HIS must be a HISTOGRAM struct as defined in HISTO2 or HISTO3.
13 %     If q is a vector, the each row of Q returns the q(i)-th percentile 
14 %
15 % see also: HISTO2, HISTO3, QUANTILE
16
17 %       $Id$
18 %       Copyright (C) 1996-2003,2005,2006,2007,2009 by Alois Schloegl <alois.schloegl@gmail.com>        
19 %       This function is part of the NaN-toolbox
20 %       http://pub.ist.ac.at/~schloegl/matlab/NaN/
21
22 %    This program is free software; you can redistribute it and/or modify
23 %    it under the terms of the GNU General Public License as published by
24 %    the Free Software Foundation; either version 2 of the License, or
25 %    (at your option) any later version.
26 %
27 %    This program is distributed in the hope that it will be useful,
28 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
29 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 %    GNU General Public License for more details.
31 %
32 %    You should have received a copy of the GNU General Public License
33 %    along with this program; If not, see <http://www.gnu.org/licenses/>.
34
35
36 if nargin==2,
37         Q = quantile(Y,q/100); 
38
39 elseif nargin==3,
40         Q = quantile(Y,q/100,DIM); 
41
42 else
43         help percentile
44
45 end;
46
47
48