MATLAB code to Geometric Random Variable

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
neeraj.patel1
Messages
3
Reaction score
0

Homework Statement



Generate Geometric RV with Porbabilty of succcess 0.1 using only rand()


Homework Equations



rand()
geometric rv P=(1-p)^(k-1) * p where p=0.1, k is number of trial in which we get 1st success


The Attempt at a Solution



rand(n)
 
Physics news on Phys.org
neeraj.patel1 said:

Homework Statement



Generate Geometric RV with Porbabilty of succcess 0.1 using only rand()


Homework Equations



rand()
geometric rv P=(1-p)^(k-1) * p where p=0.1, k is number of trial in which we get 1st success


The Attempt at a Solution



rand(n)

Can you explain your attempt at a solution?