How to create random series of numbers following binomial distribution?

2 views (last 30 days)
Hello, I'd like to create a function which generate a series of numbers randomly, but following binomial distribution.
I looked up the Mathwork Supports and found the command 'makedist('Binomial')'
which generates a whole random distribution, not the specific case belongs to each distribution what I am looking for.
For example, there are two discrete cases, say, 0 and 1, written on the head and tail of a coin,
respectively,
and suppose you throw the coin and record the series of each result, 0 or 1, e.g. 0,1,1,0,1,1,0,0,0, ..
Let's define this result as 'Xi' vector, where 1=<i=<N, i denotes trial number.
Then, it is known that the distribution of X follows binomial distribution.
In this case, what I want to generate is each Xi vector.
If you have any idea, I'd appreciate if you can share it.
Thank you.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!