Y-values for the histogram

9 Ansichten (letzte 30 Tage)
Raj Arora
Raj Arora am 7 Sep. 2022
Bearbeitet: Torsten am 7 Sep. 2022
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');

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 7 Sep. 2022
Perhaps you look for histcounts? Seems like that is the function that returns what is plotted in histogram.
HTH
  3 Kommentare
Torsten
Torsten am 7 Sep. 2022
Bearbeitet: Torsten am 7 Sep. 2022
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 am 7 Sep. 2022
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by