While MATLAB does not include an inbuilt function to accomplish this, it is possible to write some simple code to do so. The following page of the MATLAB documentation provides details of the algorithm used by the "prctile" and "quantile" functions.
The following code can be used to reverse these algorithms to arrive at the percentage and cumulative probability values given a data vector "X" and a list of percentile or quantile values "Y".
For "prctile",
>> sortedX = sort(X);
>> listPercentages = (100/length(X))*(0.5:1:length(X)-0.5);
>> percentages = interp1(sortedX,listPercentages,Y);
For "quantile",
>> sortedX = sort(X);
>> listCumProb = (1/length(X))*(0.5:1:length(X)-0.5);
>> cumProbs = interp1(sortedX,listCumProb,Y);
Best Answer