MATLAB: How to: Control Histogram bin width

hist bins

Hi
Matlab chooses its own bin width when u use hist().
But I want, for example to make an histogram which makes bins of each 0.5 width. I noticed that hist uses the entire data range as range.
bin_width ( get from edit field)
data=[1:10];
range=max(data)-min(data);
bins= bin_width * range
[n xout]= hist (data, bins)
this still makes random hist where u dont have control over the bins.
what i want is,select the bin_width , 0.5 , plot first bin between 0 – 0.5 , second 0.5- 1 etc.

Best Answer

Try
doc histc