title: Match Matlab hist() with Numpy histogram()
body: <p>I have read <a href="https://www.mathworks.com/help/matlab/ref/hist.html" rel="nofollow noreferrer">this</a> and <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html" rel="nofollow noreferrer">this</a>, plus some related SO questions like <a href="https://stackoverflow.com/questions/18065951/why-does-numpy-histogram-python-leave-off-one-element-as-compared-to-hist-in-m">this</a>. Still can not figure out the solution.</p>
  
  <p>I try to replicate the hist() function in Matlab, I get the result of different dimensions, that causing the values inside to be different. I am aware of bin-center vs bin-edge, I still want to match Matlab results.</p>
  
  <p>Matlab:</p>
  
  <pre><code>a = [1,2,3];
  [w,t] = hist(a);
  w = [1, 0, 0, 0, 1, 0, 0, 0, 0, 1]
  t = [1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9]
  length(t) = 10
  </code></pre>
  
  <p>Python:</p>
  
  <pre><code>a = [1,2,3]
  w,t = histogram(a)
  w = [1, 0, 0, 0, 0, 1, 0, 0, 0, 1]
  t = [1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0]
  len(t) = 11
  </code></pre>
  
  <p>I can of course code my own function, but I am trying to avoid wheel re-invention if there is something built-in.</p>