Main Content

unidpdf

Discrete uniform probability density function

Syntax

Y = unidpdf(X,N)

Description

Y = unidpdf(X,N)computes the discrete uniform pdf at each of the values inXusing the corresponding maximum observable value inN.XandNcan 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 inNmust be positive integers.

The discrete uniform pdf is

y = f ( x | N ) = 1 N I ( 1 , ... , N ) ( x )

You can think ofyas the probability of observing any one number between 1 andn.

Examples

For fixedn, 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 fixx, and varyn.

可能性可能性= unidpdf (9) 0.2000 = 00.1667 0.1429 0.1250 0.1111

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a