Cumulative histogram with bin being values greater than or equal.
3 ビュー (過去 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!
