How do I find the percentage of a number of values within a certain range?
35 次查看(过去 30 天)
显示 更早的评论
I have a number of values which represent the differences between two surfaces. I would like to know the percentage of values which lie within a certain range e.g 0.05 and -0.05? How would I go about finding these values and then working out what percentage of the total?
0 个评论
采纳的回答
更多回答(1 个)
Guillaume
2017-4-28
编辑:Guillaume
2017-4-28
sum(x > -0.05 & x < 0.05) / numel(x) %number of values between -0.05 and 0.05 divided by total number
Or if you want to do that with several interval, use histcounts with the 'Normalization', 'probability' option.
histcounts(x, -3.5:3.5, 'Normalization', 'probability'); %for example for 6 bins
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!