Histogram from numberdensity values.
Mostrar comentarios más antiguos
Dear All,
I have a data of x and y, where x is the radius of the particles and y denotes the number density of particles that has radius in x. Now I would like to make a histogram, could you kindly help me with it.
Sample Data:
x = [6 5 3 23 67 33 74]
y = [5 8 2 4 9 2 1] *1e24
Thanks in advance
Respuestas (2)
x = [6 5 3 23 67 33 74];
y = [5 8 2 4 9 2 1] *1e24;
bar(x,y)
That already is a histogram. It's just badly named. x is the histogram bin value (represents radius), and y is the histogram count value (representing what you call "density" but is the number of data points with the associated x (radius) value. You can plot this histogram simply with the bar function.
x = [6 5 3 23 67 33 74];
y = [5 8 2 4 9 2 1] *1e24;
bar(x, y);
xlabel('radius')
ylabel('Count')
title('Histogram of Radii')
grid on;
The histogram function is not needed because your x and y are already a histogram. You don't need to "make a histogram" because you already have it. If you want to normalize it by dividing by the tallest value, or the sum of all values, you could of course do that.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

