Hauptinhalt

unidinv

Discrete uniform inverse cumulative distribution function

Description

x = unidinv(p,n) returns the inverse cumulative distribution function (icdf) of the discrete uniform distribution with the maximum values in n, evaluated at the probability values in p.

example

Examples

collapse all

Compute the inverse cdf (icdf) values evaluated at the probability values in p for the discrete uniform distribution with the maximum value n.

p = 0.005:0.01:0.995;
n = 10;
x = unidinv(p,n);

Plot the icdf.

plot(p,x)
grid on
xlabel("p");
ylabel("x");

Figure contains an axes object. The axes object with xlabel p, ylabel x contains an object of type line.

Input Arguments

collapse all

Probability values at which to evaluate the icdf, specified as a scalar value or an array of scalar values in the range [0,1].

To evaluate the icdf at multiple values, specify p as an array. To evaluate the icdfs of multiple distributions, specify n as an array. If both p and n are arrays, they must have the same size. If either p or n is a scalar, unidinv expands the scalar input argument into a constant array of the same size as the other input argument. Each element in x is the icdf value of the distribution specified by the corresponding element in n, evaluated at the corresponding element in p.

Data Types: single | double

Maximum value in the discrete uniform distribution, specified as a positive integer or an array of positive integers.

To evaluate the icdf at multiple values, specify p as an array. To evaluate the icdfs of multiple distributions, specify n as an array. If both p and n are arrays, they must have the same size. If either p or n is a scalar, unidinv expands the scalar input argument into a constant array of the same size as the other input argument. Each element in x is the icdf value of the distribution specified by the corresponding element in n, evaluated at the corresponding element in p.

Data Types: single | double

Output Arguments

collapse all

Inverse cdf values evaluated at the probabilities in p, returned as a scalar value or an array of scalar values. x is the same size as p and n after any necessary scalar expansion. Each element in x is the icdf value of the distribution specified by the corresponding element in n, evaluated at the corresponding probabilities in p.

Alternative Functionality

  • unidinv is a function specific to the discrete uniform distribution. Statistics and Machine Learning Toolbox™ also offers the generic function icdf, which supports various probability distributions. To use icdf, specify the probability distribution name and its parameters. Note that the distribution-specific function unidinv is faster than the generic function icdf.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a