Y-values for the histogram

2 次查看(过去 30 天)
Can anyone tell me how can I extract the y-values of the below histogram so that I can plot in any software
randlp2 = exp( gamrnd(26.803,1/8.8801,50000,1)+1.6729 )
figure(1);
x = histogram(randlp2,'normalization','pdf');

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2022-9-7
Perhaps you look for histcounts? Seems like that is the function that returns what is plotted in histogram.
HTH
  3 个评论
Torsten
Torsten 2022-9-7
编辑:Torsten 2022-9-7
randlp2 = exp( gamrnd(26.803,1/8.8801,50000,1)+1.6729 );
figure(1);
x = histogram(randlp2,'normalization','pdf')
x =
Histogram with properties: Data: [50000×1 double] Values: [1.6000e-05 4.7400e-04 0.0025 0.0053 0.0072 0.0079 0.0083 0.0081 0.0075 0.0067 0.0058 0.0052 0.0043 0.0037 0.0032 0.0028 0.0023 0.0022 0.0020 0.0016 0.0014 0.0012 0.0011 9.7600e-04 8.4800e-04 7.7000e-04 6.9800e-04 5.6400e-04 … ] NumBins: 209 BinEdges: [10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 … ] BinWidth: 10 BinLimits: [10 2100] Normalization: 'pdf' FaceColor: 'auto' EdgeColor: [0 0 0] Show all properties
x.Values
ans = 1×209
0.0000 0.0005 0.0025 0.0053 0.0072 0.0079 0.0083 0.0081 0.0075 0.0067 0.0058 0.0052 0.0043 0.0037 0.0032 0.0028 0.0023 0.0022 0.0020 0.0016 0.0014 0.0012 0.0011 0.0010 0.0008 0.0008 0.0007 0.0006 0.0005 0.0005
sum(x.BinWidth*x.Values)
ans = 1.0000
Raj Arora
Raj Arora 2022-9-7
Thanks Bjorn, I was trying the same earlier, when I was clicking on x some property inspector was opening now I just mentioned x.Values.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by