MATLAB code to Geometric Random Variable

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
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?