Unifdf: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Uniform distribution. | Uniform distribution. | ||
===Synopsis=== | ===Synopsis=== | ||
:prob = unifdf(function,x,a,b) | :prob = unifdf(function,x,a,b) | ||
===Description=== | ===Description=== | ||
Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Uniform distribution. | 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. | This distribution is used when all possible outcomes of an experiment are equally likely. The distribution is flat with no peak. | ||
====INPUTS==== | ====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' ]. | * '''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). | * '''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=quantile - matrix with values in the interval (0,1). | ||
* '''for''' function=random - vector indicating the size of the random matrix to create. | * '''for''' function=random - vector indicating the size of the random matrix to create. | ||
* '''a''' = "min" parameter (real). | * '''a''' = "min" parameter (real). | ||
* '''b''' = "max" parameter (real and >= min). | * '''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''': 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. | '''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=== | ===Examples=== | ||
====Cumulative:==== | ====Cumulative:==== | ||
>> prob = unifdf('c',1.5,1,2) | >> prob = unifdf('c',1.5,1,2) | ||
prob = | prob = | ||
0.5000 | 0.5000 | ||
>> x = [0:0.1:10]; | >> x = [0:0.1:10]; | ||
>> plot(x,unifdf('c',x,1,2),'b-',x,unifdf('c',x,3,7),'r-') | >> plot(x,unifdf('c',x,1,2),'b-',x,unifdf('c',x,3,7),'r-') | ||
====Density:==== | ====Density:==== | ||
>> prob = unifdf('d',1.5,1,2) | >> prob = unifdf('d',1.5,1,2) | ||
prob = | prob = | ||
1.0000 | 1.0000 | ||
>> x = [0:0.01:10]; | >> x = [0:0.01:10]; | ||
>> plot(x,unifdf('d',x,1,3),'b-',x,unifdf('d',x,1,4),'r-') | >> plot(x,unifdf('d',x,1,3),'b-',x,unifdf('d',x,1,4),'r-') | ||
>> ylim([0 1]) | >> ylim([0 1]) | ||
====Quantile:==== | ====Quantile:==== | ||
>> prob = unifdf('q',0.5,1,2) | >> prob = unifdf('q',0.5,1,2) | ||
prob = | prob = | ||
1.5 | 1.5 | ||
====Random:==== | ====Random:==== | ||
>> prob = unifdf('r',[4 1],2,1) | >> prob = unifdf('r',[4 1],2,1) | ||
ans = | ans = | ||
1.9218 | 1.9218 | ||
1.7382 | 1.7382 | ||
1.1763 | 1.1763 | ||
1.4057 | 1.4057 | ||
===See Also=== | ===See Also=== | ||
[[betadr]], [[cauchydf]], [[chidf]], [[expdf]], [[gammadf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[weibulldf]] | [[betadr]], [[cauchydf]], [[chidf]], [[expdf]], [[gammadf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[weibulldf]] |
Revision as of 15:27, 3 September 2008
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
betadr, cauchydf, chidf, expdf, gammadf, gumbeldf, laplacedf, logisdf, lognormdf, normdf, paretodf, raydf, triangledf, weibulldf