Cumulative histogram with bin being values greater than or equal.
7 次查看(过去 30 天)
显示 更早的评论
I'm trying to plot a dose volume histogram and I know that I can use histogram(X, 'Normalization', 'cdf') in order to plot a cumulative distributive histogram where each bin is all values less than or equal to the bin value. However, I would like to have a histogram where each bin is all values greater than or equal to the bin value. Does anyone know of a simple way to accomplish that in MATLAB?
0 个评论
采纳的回答
Image Analyst
2021-12-19
Do you mean like this:
data = randn(100000, 1);
[counts, edges] = histcounts(data)
subplot(3, 1, 1);
bar(edges(1:end-1), counts)
grid on;
xlabel('Value')
ylabel('Counts')
title('Histogram')
% Compute cdf
cdf = rescale(cumsum(counts), 0, 100);
subplot(3, 1, 2);
bar(edges(1:end-1), cdf);
grid on;
xlabel('Value')
ylabel('Percent')
title('CDF')
% where each bin is all values greater than or equal to the bin value.
subplot(3, 1, 3);
bar(edges(1:end-1), 100-cdf); % or fliplr(cdf)
grid on;
xlabel('Value')
ylabel('Percent')
title('CDF')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
