필터 지우기
필터 지우기

How to draw histogram with known values and their ratio?

조회 수: 2 (최근 30일)
Wenyi Xiao
Wenyi Xiao 2019년 7월 7일
댓글: Wenyi Xiao 2019년 7월 7일
WeChat Image_20190707222508.png
Row 2 is the ratio and Row 3 are X values.
My question is how to draw a distribution plot with known X values and their specific values of ratio.

답변 (1개)

Image Analyst
Image Analyst 2019년 7월 7일
Do you mean row? Or column?
Have you tried
histogram(data(:, 2));
And I really have no idea what "a distribution plot with known X values and their specific values of ratio." is. Maybe you can re-word that to explain it better.
But in general histogram() creates and plots distributions as bar charts. Or you can use histcounts() followed by bar().
  댓글 수: 3
Image Analyst
Image Analyst 2019년 7월 7일
Still not clear, but this seems to be what you said:
edges = [-inf, 10, 20, 30, inf];
histogram(X(:, 3), edges); % Histogram of col3 with specified bin edges.
column2Sum = sum(X(:, 2)) % Sum up column 2.
Wenyi Xiao
Wenyi Xiao 2019년 7월 7일
But I want to present the specific values of each probability.
Column 2 represents the probability.
WeChat Screenshot_20190707233729.png
I can round the Column 3 and I want to group these values. For example, 10,12,14,16 and 18 should be 10, and the probability of this unit is summing up the 0.0167,0.0173,0.0185,0.0204 and 0.0235.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by