-1

I want to generate 60 random numbers from a poisson distribution with a mean of M = 4 and a range of min = 2 max = 9. Does anybody know how to solve this (preferably in Matlab?).

Best!

No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
  • Draw uniform numbers in [0, 1) and use that as the input to a quantile function associated with the poisson with mean 4. Reject numbers out of your range. – Bathsheba Sep 09 '13 at 13:05

1 Answers1

1

If you have the Statistics toolbox, you can use poissrnd...

Couitchy
  • 1,079
  • 10
  • 15
  • Yes, I used lambda = 4; poissrnd(lambda, 60); but here, I cannot specify a range... – Ramzi Fatfouta Sep 09 '13 at 13:12
  • @Ramzi, no self-respecting library would offer a range function as it completely ruins the generator. You'll need to do that bit yourself. +1 for the answer. – Bathsheba Sep 09 '13 at 13:19
  • I see! So I have to let Matlab generate the numbers and then select (post hoc) only those values that are in the range of interest? Okay, seems plausible. – Ramzi Fatfouta Sep 09 '13 at 14:12