Histogram from numberdensity values.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 2
답변 (2개)
Image Analyst
2023년 1월 6일
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:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!