Problem in calculating 30th percentile
5 views (last 30 days)
I am trying to calculate the 30th percentile. I tried using prctile function but didn't get the result. I've calculated 50th percentile (median) as below:
Temp = 437x1 double:
Area = 437x1 double;
[G,grpTemp] = findgroups(round(Temp));
medianAr = splitapply(@median,Area,G);
Any suggestions how to calculate 30th percentile?
Rik on 21 Nov 2021
Write a function that calculates the 30th percentile for a vector. Then provide the handle to that function to splitapply.
The easiest way to calculate the 30th percentile is probably to sort your vector and index it. Note that you may need to average 2 values if the index is not an integer.