Cumulative histogram with bin being values greater than or equal.
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Edward Chen
il 19 Dic 2021
Risposto: Image Analyst
il 19 Dic 2021
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 Commenti
Risposta accettata
Image Analyst
il 19 Dic 2021
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Histograms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
