MATLAB Answers

Equal Bin Sizes in Histogram Probability Distribution Function (PDF)

조회 수: 4(최근 30일)
Nihar Jariwala
Nihar Jariwala 2021년 4월 7일
답변: Jeff Miller 2021년 4월 7일
h1 = histogram(Duration);
h1.Normalization = 'probability';
h1.BinWidth = 0.0006;
hold on
h2 = histogram(Duration1);
h2.Normalization = 'probability';
h2.Binwidth = 0.0006;
hold off
xlabel ('Log {Bubble Duration(Seconds)}','Fontsize',16);
ylabel ('Probability Distribution Function','Fontsize',16);
% ylim([0 0.16])
xlim([0 0.05])
title ('Bubble Duration - 26LPS Toe & Recirculating Region','FontSize',20)
legend ('Toe of the Jump','Recirculating Region ~ 75mm','Fontsize',16);
Hi Everyone,
I am plotting a normalised histogram (probability) & I want it on a semi-log scale, i.e, I want my X-axis to be logarthmic & I want my Yaxis to be linear as it is.
How can I have bins of equal widths in a logarthmic scale. In linear scale it is easy just specify the Bin widths & it will be equal but how do i do it in a Logarthmic scale? I am also attaching my code below.
Any Help will be much appreciated.


Jeff Miller
Jeff Miller 2021년 4월 7일
The histogram function has a parameter 'BinEdges' that will allow you to specify any bins you like. So, make whatever bin edges you like--e.g., on a log scale such as mybinedges = exp(1:5).

Community Treasure Hunt

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

Start Hunting!

Translated by