To calculate the probability of a geometric distribution in Matlab, you can use the built-in functions geopdf and geocdf.
geopdf calculates the probability mass function (PMF) of a geometric distribution. The syntax is as follows:
17 chars2 lines
where x is the number of trials until the first success, and p is the probability of success on each trial.
geocdf calculates the cumulative distribution function (CDF) of a geometric distribution. The syntax is as follows:
17 chars2 lines
where x is the number of trials until the first success, and p is the probability of success on each trial.
Here's an example code snippet that calculates the PMF and CDF of a geometric distribution with a success probability of 0.2:
231 chars7 linesThis code snippet will produce a plot showing the PMF and CDF of a geometric distribution with a success probability of 0.2.
gistlibby LogSnag