?? gngauss.m
字號(hào):
function [gsrv1,gsrv2]=gngauss(m,sgma)
% [gsrv1,gsrv2]=gngauss(m,sgma);
% [gsrv1,gsrv2]=gngauss(sgma);
% [gsrv1,gsrv2]=gngauss;
% GAGAUSS generates two independent Gaussian random variables with mean m
% and standard deviation sgma. If one of the input arguments is missing,
% it takes the mean as 0; and the standard deviation as the given parameter.
% If neither mean nor the variance is given, it generates two standard
% Gaussian random variables.
if nargin==0
m=0;sgma=1;
elseif nargin==1
sgma=m;m=0;
end;
u=rand;
z=sgma*(sqrt(2*log(1/(1-u))));
u=rand;
gsrv1=m+z*cos(2*pi*u);
gsrv2=m+z*sin(2*pi*u);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -