For a given set of data, how can I define which of those correspond to the 95% of the data which are around the mean value?
No products are associated with this question.
x = rand(1, 1000) - 0.5; m = mean(x); dist = abs(x - m); [sortDist, sortIndex] = sort(dist); index_95perc = sortIndex(1:floor(0.95 * numel(x))); x_95percent = x(index_95perc);
I'd sort the data using sort(). Then use cumsum() to get the cdf. Normalize the CDF then go from the 2.5% element to the 97.5% element using find() to find the elements (values) where the data starts and stops. It's pretty easy, but let me know if you can't figure it out.