function val = findprctile(x_input, array_input)
% Find the percentile position of a value in an array
num = size(array_input,1) ;
myarray = sort(array_input, 'ascend') ;
indx = 0 ;
for i = 1:num
    if x_input > myarray(i,1)
       indx = i ;
    end
end

% prt = (num - indx)/num ;
prt = round((indx-1)/num,3) ;

val =  prt ;
    