Simulate a distribution

Hi there,

I need to simulate a binary distribution (ones and zeros) with mean=a, st. dev.=b and size=n.

Anyone know how to do that?

Thanks in advance!

1 Answer



0



You can use rndBernoulli:

// Create a 100x1 vector of
// 1's and 0's with a mean of 0.7
x = rndBernoulli(100, 1, 0.7);

aptech

1,548

Your Answer


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy