Matlab Percentile function VS excel percentile function
显示 更早的评论
Is the matlab percentile function is equal to excel percentile function. I'm getting two different answers for the same data set.
回答(2 个)
Matt Fig
2011-5-29
0 个投票
I don't see a PERCENTILE function in MATLAB. Is it a custom function you wrote?
4 个评论
vijay sabawat
2011-5-29
Matt Fig
2011-5-29
Oh, the PRCTILE function. How different are the values you get?
vijay sabawat
2011-5-29
vijay sabawat
2011-5-29
Oleg Komarov
2011-5-29
I get the same results:
A = rand(1000,1);
B = prctile(A,30:20:70)
xlswrite('C:\Users\Oleg\Desktop\test.xlsx',A)
and then using PERCENTILE($A$1:$A$1000,0.3)
EDIT
Excel interpolates for values of the percentile that are not multiples of 1/(n-1). So the 25th percentile on 1:5 = 2! (online reference: percentile)
=PERCENTILE(A1:A5,0.25) where A1:A5 = 1:5 --> 2
Matlab interpolates for percentile values that are not (i -.5)/n, for i = 2, 1.5/5 = .3 which is not the 25th percentile.
prctile(1:5, .25) --> 1.7500 % Which makes more sense IMO
Hope this clarifies.
类别
在 帮助中心 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!