<< Uniform Discrete Uniform Discrete distfun_unidinv >>

distfun >> distfun > Uniform Discrete > distfun_unidcdf

distfun_unidcdf

Uniform Discrete CDF

Calling Sequence

p = distfun_unidcdf ( x , N )
p = distfun_unidcdf ( x , N , lowertail )

Parameters

x :

a matrix of doubles, the outcome

N :

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

lowertail :

a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).

p :

a matrix of doubles, the probability.

Description

Computes the cumulated 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,a,b) =
\left\{
\begin{array}{l}
0, \textrm{ if } x\leq 1, \\
\frac{\lfloor x\rfloor}{N}, \textrm{ if } x\in[1,N], \\
1, \textrm{ if } x\geq N.
\end{array}
\right.
\end{eqnarray}

Examples

// Test expanded arguments
c = distfun_unidcdf ( [1 2 3] , [4 5 6] )
e = [ 0. 0.25 0.4]

// Plot the function
N=5;
scf();
x = 1:N;
y = distfun_unidcdf(x , N);
plot(x,y,"ro-");
h.children.data_bounds(:,2)=[0;1];
xtitle("Uniform Discrete CDF (N=5)","x","$P(X\leq x)$");

// See upper tail
p = distfun_unidcdf ( 3, 7 )
q = distfun_unidcdf ( 3, 7 , %f )
p+q

Authors


Report an issue
<< Uniform Discrete Uniform Discrete distfun_unidinv >>