| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
X = geoinv(Y,P)
X = geoinv(Y,P) returns the smallest positive integer X such that the geometric cdf evaluated at X is equal to or exceeds Y. You can think of Y as the probability of observing X successes in a row in independent trials where P is the probability of success in each trial.
Y and P can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input for P or Y is expanded to a constant array with the same dimensions as the other input. The values in P and Y must lie on the interval [0 1].
The probability of correctly guessing the result of 10 coin tosses in a row is less than 0.001 (unless the coin is not fair).
psychic = geoinv(0.999,0.5) psychic = 9
The example below shows the inverse method for generating random numbers from the geometric distribution.
rndgeo = geoinv(rand(2,5),0.5) rndgeo = 0 1 3 1 0 0 1 0 2 0
icdf, geocdf, geopdf, geostat, geornd
![]() | geocdf | geomean | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |