Statistics Toolbox | ![]() ![]() |
Syntax
Description
Y = prctile(X,p)
calculates a value that is greater than p
percent of the values in X
. The values of p
must lie in the interval [0 100].
For vectors, prctile(X,p)
is the p
th percentile of the elements in X
. For instance, if p
= 50
then Y
is the median of X
.
For matrix X
and scalar p
, prctile(X,p)
is a row vector containing the p
th percentile of each column. If p is a vector, the ith row of Y is p(i)
of X
.
Examples
x = (1:5)'*(1:5) x = 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25 y = prctile(x,[25 50 75]) y = 1.7500 3.5000 5.2500 7.0000 8.7500 3.0000 6.0000 9.0000 12.0000 15.0000 4.2500 8.5000 12.7500 17.0000 21.2500
![]() | polyval | princomp | ![]() |