distrmu.m

来自「用matalab开发的随机数生成程序包」· M 代码 · 共 47 行

M
47
字号
function [mu] = distrmu(distr, dpar)
 
% DISTRMU a table-lookup function. For a given handle to an external
% random number generator extracts the expected value from its
% parameter list.  
%
% [mu] = distrmu(distr, dpar)
%
% Inputs:
%      distr - pointer to an external function generating random
%        numbers from the desired distribution:
%                @rand: uniform in (0,1)
%                @simexp: Exp(lambda)
%                @simparetonrm: Pareto(alpha, gamma) (see SIMPARETONRM) 
%                @randn: standard normal
%       dpar - a cell array of the distribution parameters 
%
% Outputs:
%      mu - the expected value
%
% See also DISTRSTAT.

% Author: R.Gaigalas
% v1.0 06-Oct-05


  switch func2str(distr)
%  switch distr
   case 'ones' % degenerate=1 wp1 - counting process
      mu = 1;
        
   case 'rand' % uniform (0,1)
      mu = 0.5;
      
   case 'simexp' % Exp(lambda)
      mu = 1/dpar{1};
      
   case 'simparetonrm' % Pareto(alpha, gamma)
      mu = 1/(dpar{2}*(dpar{1}-1)); 

      
    otherwise
      error('Bad parameter <distr>');
      return;
 
  end  

⌨️ 快捷键说明

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