How to Convert A Matrix Into a Custom Binned Histogram (Histogram of Variance Value)
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Reid
el 31 de Mzo. de 2014
Comentada: Reid
el 3 de Abr. de 2014
Although I'm rather new to MATLAB scripting, I tried to search around before posing this question and could not seem to find any help regarding trying to plot a histogram of the variance value from my 10,000 X 10,000 array.
For example, all the pixels in this array contain values ranging from 0-255 and I would like to make a histogram showing how many of these pixels have a value between x-y, then between y-z, etc and divide the WHOLE range into at least 100 bins. More specifically, if one was looking at the final scaled plot, the range would be 0-255, where there is a bin every increment of 10: 0-<10, 10-<20, 20-<30, etc. The bin values would be on the X-axis and the # of pixels falling into each bin would be on the Y-axis.
Any help or pointers would be GREATLY appreciated!
Thanks
-Reid
0 comentarios
Respuesta aceptada
Andrew Sykes
el 31 de Mzo. de 2014
This might help. Assume "A" is your 10,000 X 10,000 array (preset in this example by random numbers, so ignore the first line of this code if you like).
A=rand(1e4,1e4)*255;
Avec=reshape(A,1e4*1e4,1);
bin_increment=10;
NumberOfBins=ceil(255/bin_increment);
hist(A,NumberOfBins)
This code should produce a figure with the histogram you want. Alternatively, you may wish to actually store the histogram data:
BinPopulations=hist(A,NumberOfBins)
This will generate a vector telling you how many pixels are in each bin.
HTH.
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!