⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simgeom.m

📁 用matalab开发的随机数生成程序包
💻 M
字号:
function [sample] = simgeom(npoints, p)
% SIMGEOM random numbers from geometric distribution
%  pdf p(k)=p(1-p)^k,   k=0,1,...
% 
% [sample] = simgeom(npoints, p)
%
% Inputs: npoints - sample size
%         p - parameter of the distribution
%
% Outputs: sample - vector of random numbers
%
% See also SIMBINOM, SIMDISCR, SIMEXP, SIMPARETO

% Authors: R.Gaigalas, I.Kaj
% v1.2 04-Oct-02

  % generate a sample of Exp(lambda) with lambda=-log(1-p)
  % and take the largest integer less than or equal to the result 
  sample = floor(log(rand(1, npoints))./log(1-p));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -