To calculate the probability of a Poisson distribution in Matlab, you can use the poisspdf
function. This function takes two inputs: the value(s) at which you want to calculate the probability, and the mean of the Poisson distribution.
Here's an example usage:
main.m156 chars5 lines
This will give you the probability of observing exactly x
events in a Poisson process with mean lambda
. If you want to calculate the probability of observing x
or fewer (or x
or more) events, you can use the poisscdf
function instead:
main.m123 chars3 lines
Again, lambda
is the mean of the Poisson distribution, and 2
is the value we're interested in. The poisscdf
function calculates the cumulative distribution function (CDF) of the Poisson distribution, so prob_less_than_two
will give us the probability of observing 0 or 1 events, and prob_more_than_two
will give us the probability of observing 2 or more events.
gistlibby LogSnag