function r = laplacernd(mu,b,varargin);
% LAPLACE Random arrays from the laplace distribution.
% 获取Laplace distribution的随机样本
% 从normrnd改编得到
% R = LAPLACERND(MU,B) returns an array of random numbers chosen from a
% laplace distribution with mean MU and B. The size
% of R is the common size of MU and SIGMA if both are arrays. If either
% parameter is a scalar, the size of R is the size of the other
% parameter.
%
% R = LAPLACERND(MU,B,M,N,...) or R = LAPLACERND(MU,B,[M,N,...])
% returns an M-by-N-by-... array.
%
% See also LAPLACEPDF
if nargin < 2
error('stats:laplacernd:TooFewInputs','Requires at least two input arguments.');
end
[err, sizeOut] = statsizechk(2,mu,b,varargin{:});
if err > 0
error('stats:laplacernd:InputSizeMismatch','Size information is inconsistent.');
end
% Return NaN for elements corresponding to illegal parameter values.
sigma(b < 0) = NaN;
% Generate uniform random values, and apply the laplace inverse CDF.
% abs(r-mu)=-(1/b).*log(rand(sizeOut));这儿怎么求出r是个问题
- 1
- 2
前往页