I am trying to convert some Matlab code to Python, and the Matlab code looks like this:
[N,X] = hist(Isb*1e6, -3:0.01:0)
where Isb is a 1D array of size 2048000. N is output as an array of 1D type 301.
My Python code looks like this:
import numpy as np N,X = np.histogram(Isb*1e6,np.array(-3,0.01,0.01))
but the Python N outputs are a 300 element 1D array in which the last element from Matlab N is left.
Is there a way to reproduce what Matlab does more accurately?
I need N and X to be the same size so I can do this:
loc = X < -0.75 I = N[loc].argmax()
source share