If n is in (0,1), then q is the n-th quantile of x (n*100 percent quantile) If n<0, then q is the (n+1)-th largest entry of x If n>1, then q is the n-th smallest entry of x
Syntax
q = quantile(x,n)
Input
x | double |
n | double |
Output
q | double |
Example
[~,x]=sort(rand(1,1000));
quantile(x,3) % third smallest entry
quantile(x,-2) % third largest entry
quantile(x,0.25) % 25 percent quantile
ans =
3
ans =
998
ans =
250