To find histogram of two variables

조회 수: 6 (최근 30일)
Shalmiya Paulraj SOC
Shalmiya Paulraj SOC 2022년 7월 13일
댓글: KSSV 2022년 7월 13일
Hi,
I need to find Histogram properties of two variable x and y and to store it in a separate cell array a. I have used below code but, I am getting only the histogram properties of y, Kindly help me with this. Thanks in advance.
x = rand(1000,1);
y = rand(1500,1);
a = histogram(x);
b = histogram(y);
c = {a;b};

채택된 답변

KSSV
KSSV 2022년 7월 13일
x = rand(1000,1);
y = rand(1500,1);
[N{1},edges{1}] = histcounts(x);
[N{2},edges{2}] = histcounts(y);
  댓글 수: 1
KSSV
KSSV 2022년 7월 13일
x = rand(1000,1);
y = rand(1500,1);
figure(1)
h(1) = histogram(x);
figure(2)
h(2) = histogram(y);
h(1)
ans =
Histogram with properties: Data: [1000×1 double] Values: [97 93 90 107 118 86 113 103 91 102] NumBins: 10 BinEdges: [0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1] BinWidth: 0.1000 BinLimits: [0 1] Normalization: 'count' FaceColor: 'auto' EdgeColor: [0 0 0] Show all properties
h(2)
ans =
Histogram with properties: Data: [1500×1 double] Values: [154 167 150 139 161 157 116 163 140 153] NumBins: 10 BinEdges: [0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1] BinWidth: 0.1000 BinLimits: [0 1] Normalization: 'count' FaceColor: 'auto' EdgeColor: [0 0 0] Show all properties

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

추가 답변 (0개)

카테고리

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