MATLAB: Calculating Percentile from a pdf

MATLABpdfpercentileprobability

Hi,
I have a data with two columns: Column 1 is the variable, and Column 2 is the probability density. I am pasting a sample of the data, but overall cumsum(COlumn2) = 100, as it should be.
Snap4.png
Question is, how do I get the 5th percentile of Column 1 (given the probabilities associated with each number). I have tried a number of things but coming at the dead-end. APologies in advance in case its too naive.

Best Answer

If I interpret the want correctly...let z,v be your two columns--then
ecfn=ecdf(v); % empirical cumulative distribution function values
N=fix(numel(v)/2); % first half--assume symmetric distribution
P=0.05; % desired percentile (less 50th percentile)
z05=interp1(v(1:N),z(1:N),P); % find the Pth percentile