matlab的quantile函数,Quantile 函数详解

在matlab

图像处理应用中,经常会用到quantile函数,这个函数的作用是求数列或矩阵的分位数。

在程序中给的文档说明如下:

语法

Y = quantile(X,p)

Y =

quantile(X,p,dim)

Y = quantile(X,N,...)

描述  Y = quantile(X,p) returns

quantiles of the values in X. p is a scalar or a vector of

cumulative probability values. When X is a vector, Y is the same

size as p, and Y(i) contains the p(i)th quantile. When X is a

matrix, the ith row of Y contains the p(i)th quantiles of each

column of X. For n-dimensional arrays, quantile operates along the

first nonsingleton dimension of X.

Y = quantile(X,p,dim)

calculates quantiles along dimension dim. The dimth dimension of Y

has length length(P).  Quantiles are specified

using cumulative probabilities from 0 to 1. For an n-element vector

X, quantile computes quantiles as follows:  1. The

sorted values in X are taken as the (0.5/n), (1.5/n), ...,

([n–0.5]/n) quantiles.  2.

Linear interpolation is used to compute quantiles for probabilities

between (0.5/n) and ([n–0.5]/n).

3. The minimum or maximum values in X are

assigned to quantiles for probabilities outside that range.

quantile treats NaNs as missing values and

removes them.

Y = quantile(X,N,...) returns quantiles at the N

evenly-spaced cumulative probabilities (1:N)/(N+1). N is a scalar

positive integer value.

​举例:

x[1 1 2 3 4 5 5 8 10]

数组中有9个元素,

n=9 p=0.6

y=quantile(x,p);

也可以写成y=quantile(a(:),[.6]);

得到:y=4.9

a4c26d1e5885305701be709a3d33442f.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值