How to set the Bin width of the histogram ?

266 visualizaciones (últimos 30 días)
karanvir sidhu
karanvir sidhu el 13 de Jun. de 2019
Respondida: Paramjit Yadav el 8 de Jul. de 2021
I am setting the bin width to 0.05 as can be in seen in the code snipet below
h1 = histogram(Data);
h1.Normalization = 'probability';
h1.BinWidth = 0.05;
But the histogram does not set the bin width to 0.05. It varies every time I run the function.
Please help.
  1 comentario
the cyclist
the cyclist el 13 de Jun. de 2019
This code set the bin width to 0.05 for me, as expected.
Data = rand(100,1);
h1 = histogram(Data);
h1.Normalization = 'probability';
h1.BinWidth = 0.05;
Can you upload an example of the variable Data that exhibits the problem?

Iniciar sesión para comentar.

Respuestas (2)

Paramjit Yadav
Paramjit Yadav el 8 de Jul. de 2021
How to set the bin width and bin edges simulataneously. Please help.
  2 comentarios
the cyclist
the cyclist el 8 de Jul. de 2021
Editada: the cyclist el 8 de Jul. de 2021
If you define the edges, then the widths are determined by the differences between the edges. I don't see how your question makes sense.
Also, you might want to ask a new question. The way you entered this, it is appearing as an "answer" to another question.
Steven Lord
Steven Lord el 8 de Jul. de 2021
If you're explicitly setting the bin edges, that fixes the bin widths (potentially to non-uniform values.) So just set the edges.

Iniciar sesión para comentar.


Paramjit Yadav
Paramjit Yadav el 8 de Jul. de 2021
Thank you so much.

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by