Products & Services Solutions Academia Support User Community Company

Learn more about Communications Toolbox   

Random Symbols

The randsrc function generates random matrices whose entries are chosen independently from an alphabet that you specify, with a distribution that you specify. A special case generates bipolar matrices.

For example, the command below generates a 5-by-4 matrix whose entries are independently chosen and uniformly distributed in the set {1,3,5}. (Your results might vary because these are random numbers.)

a = randsrc(5,4,[1,3,5])

a =

     3     5     1     5
     1     5     3     3
     1     3     3     1
     1     1     3     5
     3     1     1     3

If you want 1 to be twice as likely to occur as either 3 or 5, use the command below to prescribe the skewed distribution. The third input argument has two rows, one of which indicates the possible values of b and the other indicates the probability of each value.

b = randsrc(5,4,[1,3,5; .5,.25,.25])

b =

     3     3     5     1
     1     1     1     1
     1     5     1     1
     1     3     1     3
     3     1     3     1
  


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-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS