To find histogram of two variables

3 次查看(过去 30 天)
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