Continuous uniform probability density function
Y = unifpdf(X,A,B)
Y = unifpdf(X,A,B) computes the continuous uniform pdf at each of the values in X using the corresponding lower endpoint (minimum), A and upper endpoint (maximum), B. X, A, and B can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in B must be greater than those in A.
The continuous uniform distribution pdf is
The standard uniform distribution has A = 0 and B = 1.
For fixed a and b, the uniform pdf is constant.
x = 0.1:0.1:0.6; y = unifpdf(x) y = 1 1 1 1 1 1
What if x is not between a and b?
y = unifpdf(-1,0,1) y = 0