1 function Q=percentile(Y,q,DIM)
2 % PERCENTILE calculates the percentiles of histograms and sample arrays.
5 % Q = percentile(Y,q,DIM)
6 % returns the q-th percentile along dimension DIM of sample array Y.
7 % size(Q) is equal size(Y) except for dimension DIM which is size(Q,DIM)=length(Q)
9 % Q = percentile(HIS,q)
10 % returns the q-th percentile from the histogram HIS.
11 % HIS must be a HISTOGRAM struct as defined in HISTO2 or HISTO3.
12 % If q is a vector, the each row of Q returns the q(i)-th percentile
14 % see also: HISTO2, HISTO3, QUANTILE
16 % $Id: percentile.m 8223 2011-04-20 09:16:06Z schloegl $
17 % Copyright (C) 1996-2003,2005,2006,2007 by Alois Schloegl <alois.schloegl@gmail.com>
18 % This function is part of the NaN-toolbox
19 % http://pub.ist.ac.at/~schloegl/matlab/NaN/
21 % This program is free software; you can redistribute it and/or modify
22 % it under the terms of the GNU General Public License as published by
23 % the Free Software Foundation; either version 2 of the License, or
24 % (at your option) any later version.
26 % This program is distributed in the hope that it will be useful,
27 % but WITHOUT ANY WARRANTY; without even the implied warranty of
28 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 % GNU General Public License for more details.
31 % You should have received a copy of the GNU General Public License
32 % along with this program; If not, see <http://www.gnu.org/licenses/>.
36 Q = quantile(Y,q/100);
39 Q = quantile(Y,q/100,DIM);