Unifdf: Difference between revisions
imported>Jeremy No edit summary |
imported>Bob |
||
(One intermediate revision by one other user not shown) | |||
Line 13: | Line 13: | ||
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> | |||
::<math>F(x) = \frac {x-a} {b-a}</math> | |||
====Inputs==== | ====Inputs==== | ||
Line 32: | Line 36: | ||
'''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> | <pre> | ||
>> prob = unifdf('c',1.5,1,2) | >> prob = unifdf('c',1.5,1,2) | ||
Line 44: | Line 48: | ||
>> 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-') | ||
</pre> | </pre> | ||
====Density | ====Density==== | ||
<pre> | <pre> | ||
>> prob = unifdf('d',1.5,1,2) | >> prob = unifdf('d',1.5,1,2) | ||
Line 53: | Line 57: | ||
>> ylim([0 1]) | >> ylim([0 1]) | ||
</pre> | </pre> | ||
====Quantile | ====Quantile==== | ||
<pre> | <pre> | ||
>> prob = unifdf('q',0.5,1,2) | >> prob = unifdf('q',0.5,1,2) | ||
Line 59: | Line 63: | ||
1.5 | 1.5 | ||
</pre> | </pre> | ||
====Random | ====Random==== | ||
<pre> | <pre> | ||
>> prob = unifdf('r',[4 1],2,1) | >> prob = unifdf('r',[4 1],2,1) |
Latest revision as of 13: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