<< distfun_unifinv Uniform distfun_unifrnd >>

distfun >> distfun > Uniform > distfun_unifpdf

distfun_unifpdf

Uniform PDF

Calling Sequence

y = distfun_unifpdf ( x , a , b )

Parameters

x :

a matrix of doubles, the outcome

a :

a matrix of doubles, the lower bound

b :

a matrix of doubles, the upper bound (with a<=b)

y :

a matrix of doubles, the density.

Description

Computes the probability distribution function of the Uniform 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< a, \\
\frac{1}{b-a}, \textrm{ if } x\in[a,b], \\
1, \textrm{ if } x> b.
\end{array}
\right.
\end{eqnarray}

Examples

// Test expanded arguments
c = distfun_unifpdf ( [1 2 3] , [1 1 1] , [4 5 6] )
e = [ 1/3 0.25 0.2]

// Plot the function
a=2;
b=5;
scf();
x = linspace(1,6,1000);
y = distfun_unifpdf(x , a, b);
plot(x,y);
xtitle("Uniform PDF","x","y");

Authors


Report an issue
<< distfun_unifinv Uniform distfun_unifrnd >>