Unifdf: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Bob |
||
(5 intermediate revisions by one other user not shown) | |||
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. | ||
::<math> f(x) = \frac {1} {b-a}</math> | |||
* 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). | |||
::<math>F(x) = \frac {x-a} {b-a}</math> | |||
* a = "min" parameter (real). | |||
* b = "max" parameter (real and >= min). | |||
====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''': 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==== | |||
<pre> | |||
>> prob = unifdf('c',1.5,1,2) | >> prob = unifdf('c',1.5,1,2) | ||
prob = | prob = | ||
Line 24: | Line 47: | ||
>> 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 | </pre> | ||
====Density==== | |||
<pre> | |||
>> prob = unifdf('d',1.5,1,2) | >> prob = unifdf('d',1.5,1,2) | ||
prob = | prob = | ||
Line 31: | Line 56: | ||
>> 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 | </pre> | ||
====Quantile==== | |||
<pre> | |||
>> prob = unifdf('q',0.5,1,2) | >> prob = unifdf('q',0.5,1,2) | ||
prob = | prob = | ||
1.5 | 1.5 | ||
====Random | </pre> | ||
====Random==== | |||
<pre> | |||
>> prob = unifdf('r',[4 1],2,1) | >> prob = unifdf('r',[4 1],2,1) | ||
ans = | ans = | ||
Line 42: | Line 71: | ||
1.1763 | 1.1763 | ||
1.4057 | 1.4057 | ||
</pre> | |||
===See Also=== | ===See Also=== | ||
[[ | |||
[[betadf]], [[cauchydf]], [[chidf]], [[expdf]], [[gammadf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[weibulldf]] |
Latest revision as of 12:15, 10 October 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
betadf, cauchydf, chidf, expdf, gammadf, gumbeldf, laplacedf, logisdf, lognormdf, normdf, paretodf, raydf, triangledf, weibulldf