<< distfun_unidinv Uniform Discrete distfun_unidrnd >>

distfun >> distfun > Uniform Discrete > distfun_unidpdf

distfun_unidpdf

Uniform Discrete PDF

Calling Sequence

y = distfun_unidpdf ( x , N )

Parameters

x :

a matrix of doubles, the outcome, in the set {1,...,N}

N :

a matrix of doubles, integer value, the integer upper bound (with N>=1)

y :

a matrix of doubles, the density.

Description

Computes the probability distribution function of the Uniform discrete distribution function.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

The function definition is:

\begin{eqnarray}
f(x,N) =
\left\{
\begin{array}{l}
0, \textrm{ if } x< 1, \\
\frac{1}{N}, \textrm{ if } x\in[1,N], \\
1, \textrm{ if } x> N.
\end{array}
\right.
\end{eqnarray}

Examples

// Test expanded arguments
c = distfun_unidpdf ( 1:9 , 9 )
e = ones(1,9)./9

// Plot the function
N=5;
scf();
x = 1:N;
y = distfun_unidpdf(x , N);
plot(x,y,"ro-");
h.children.data_bounds(:,2)=[0;1];
xtitle("Uniform Discrete PDF (N=5)","x","y");

Authors


Report an issue
<< distfun_unidinv Uniform Discrete distfun_unidrnd >>