www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeMeanAndVarianceOfGeometricDistributionExample.m

    %% Compute Mean and Variance of Geometric Distribution
%

% Copyright 2015 The MathWorks, Inc.


%%
% Define a probability vector that contains six different parameter
% values.
p = 1./(1:6)

%%
% Compute the mean and variance of the geometric distribution that
% corresponds to each value contained in probability vector.
[m,v] = geostat(1./(1:6))

%%
% The returned values indicate that, for example, the mean of a geometric
% distribution with probability parameter _p_ equal to 1/3 is 2, and its
% variance is 6.