how to plot histogram
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Elysi Cochin
am 2 Jun. 2022
Kommentiert: Star Strider
am 2 Jun. 2022
I wanted to plot the histogram of the attached data with number of bins = 42
When i use
figure, imhist(HRGB,42)
I get just 2 vertical lines at 0 and 1.
Instead, how can i get histogram with number of bins 42, or is the below code correct?
h = histogram(HRGB,42);
Or is there a better way to plot the histogram of the attached data?
Akzeptierte Antwort
Chunru
am 2 Jun. 2022
load Xdata
% whos
figure; imshow(Xdata);
unique(Xdata(:))'
imhist assumes Xdata in the range of [0,1]. Therefore you have only two bins for 0 & 1 with your data
figure;
imhist(Xdata, 42)
You can rescale the data:
figure;
imhist(rescale(Xdata), 42);
Or you can use hist
figure
hist(Xdata(:), 42)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!