Azzera filtri
Azzera filtri

Centering a histogram around the median

13 visualizzazioni (ultimi 30 giorni)
A
A il 29 Set 2011
Hey, I have data that I am plotting a histogram with, and I want to center my histogram on the mean, with six bins (i.e 3 on each side). I need that each bin is the width of the standard deviation. Thanks in advance for any replies. Cheers, Amina

Risposte (1)

Honglei Chen
Honglei Chen il 29 Set 2011
Hi Amina,
You can specify the bin location in hist function, for example
x = rand(1024,1);
sigmax = std(x);
mx = mean(x);
binloc = (-2.5:2.5)*sigmax+mx;
hist(x,binloc)
More details can be found at
doc hist
HTH

Community Treasure Hunt

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

Start Hunting!

Translated by