Frage

In Matlab I've got a binomial PDF already defined where the set of possible events are 0-255. I would like to generate symbols, from 0-255, according to that PDF. How can I do that?

This is the code used in order to generate the PDF:

x=0:255; %range of possible values
m=255;
b=0.06245;
y=binopdf(x,m,b); %generates a binomial distribution

When plotting "y" I can see that most of the times the symbol that the source will generate will be between 9 to 23. Again, how can I design that symbol source? Thank you.

War es hilfreich?

Lösung

Use

result = binornd(m,b,R,C);

to generate an R x C matrix of random values drawn from an (m,b) binomial distribution.


If you then plot the histogram

hist(result(:),-.5:255.5)

you can check that (for R and/or C large enough) the obtained values follow the desired binomial distribution.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top