Unifdf

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Uniform distribution.

Synopsis

prob = unifdf(function,x,a,b)

Description

Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Uniform distribution.

This distribution is used when all possible outcomes of an experiment are equally likely. The distribution is flat with no peak.




Inputs

  • function = [ {'cumulative'} | 'density' | 'quantile' | 'random' ], defines the functionality to be used. Note that the function recognizes the first letter of each string so that the string could be: [ 'c' | 'd' | 'q' | 'r' ].
  • x = matrix in which the sample data is stored, in the interval (-inf,inf).
for function=quantile - matrix with values in the interval (0,1).
for function=random - vector indicating the size of the random matrix to create.
  • a = "min" parameter (real).
  • b = "max" parameter (real and >= min).

Note: If inputs (x, a, and b) are not equal in size, the function will attempt to resize all inputs to the largest input using the RESIZE function.

Note: Functions will typically allow input values outside of the acceptable range to be passed but such values will return NaN in the results.

Examples

Cumulative

>> prob = unifdf('c',1.5,1,2)
prob =
    0.5000
>> x    = [0:0.1:10];
>> plot(x,unifdf('c',x,1,2),'b-',x,unifdf('c',x,3,7),'r-')

Density

>> prob = unifdf('d',1.5,1,2)
prob =
    1.0000
>> x    = [0:0.01:10];
>> plot(x,unifdf('d',x,1,3),'b-',x,unifdf('d',x,1,4),'r-')
>> ylim([0 1])

Quantile

>> prob = unifdf('q',0.5,1,2)
prob =
    1.5

Random

>> prob = unifdf('r',[4 1],2,1)
ans =
    1.9218
    1.7382
    1.1763
    1.4057

See Also

betadf, cauchydf, chidf, expdf, gammadf, gumbeldf, laplacedf, logisdf, lognormdf, normdf, paretodf, raydf, triangledf, weibulldf