Skip to Main Content Skip to Search
Product Documentation

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 rand in most respects, including the generator used, but it does not support the 'state' and 'seed' options available in rand.

Examples

q=quantizer([4 3]);
rand('state',0)
randquant(q,3)

ans =

    0.7500   -0.1250   -0.2500
   -0.6250    0.6250   -1.0000
    0.1250    0.3750    0.5000

See Also

quantizer | rand | range | realmax

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS