Main Content

randquant

Generate uniformly distributed, quantized random number using quantizer object

Syntax

randquant(q,n)
randquant(q,m,n)
randquant(q,m,n,p,...)
randquant(q,[m,n])
randquant(q,[m,n,p,...])

Description

randquant(q,n) uses quantizer object q to generate an n-by-n matrix with random entries whose values cover the range of q when q is a fixed-point quantizer object. When q is a floating-point quantizer object, randquant populates the n-by-n array with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

randquant(q,m,n) uses quantizer object q to generate an m-by-n matrix with random entries whose values cover the range of q when q is a fixed-point quantizer object. When q is a floating-point quantizer object, randquant populates the m-by-n array with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

randquant(q,m,n,p,...) uses quantizer object q to generate an m-by-n-by-p-by ... matrix with random entries whose values cover the range of q when q is fixed-point quantizer object. When q is a floating-point quantizer object, randquant populates the matrix with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

randquant(q,[m,n]) uses quantizer object q to generate an m-by-n matrix with random entries whose values cover the range of q when q is a fixed-point quantizer object. When q is a floating-point quantizer object, randquant populates the m-by-n array with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

randquant(q,[m,n,p,...]) uses quantizer object q to generate p m-by-n matrices containing random entries whose values cover the range of q when q is a fixed-point quantizer object. When q is a floating-point quantizer object, randquant populates the m-by-n arrays with values covering the range

-[square root of realmax(q)] to [square root of realmax(q)]

randquant produces pseudorandom numbers. The number sequence randquant generates during each call is determined by the state of the generator. Because MATLAB® resets the random number generator state at startup, the sequence of random numbers generated by the function remains the same unless you change the state.

randquant works like rng in most respects.

Examples

q = quantizer([4 3]);
rng('default')
randquant(q,3)
ans =

                     0.5                   0.625                    -0.5
                   0.625                   0.125                       0
                  -0.875                  -0.875                    0.75

Version History

Introduced before R2006a

See Also

| | |