Discrete uniform probability density function


Y = unidpdf(X,N)


Y = unidpdf(X,N) computes the discrete uniform pdf at each of the values in X using the corresponding maximum observable value in N. X and N can be vectors, matrices, or multidimensional arrays that have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in N must be positive integers.

The discrete uniform pdf is


You can think of y as the probability of observing any one number between 1 and n.


For fixed n, the uniform discrete pdf is a constant.

y = unidpdf(1:6,10)
y =
  0.1000  0.1000  0.1000  0.1000  0.1000  0.1000

Now fix x, and vary n.

likelihood = unidpdf(5,4:9)
likelihood =
  0  0.2000  0.1667  0.1429  0.1250  0.1111
Was this topic helpful?