poissonjp.m
来自「用matalab开发的随机数生成程序包」· M 代码 · 共 31 行
M
31 行
function [pjump] = poissonjp(njumps, lambda, ntraj)
% POISSONJP generate and plot a number of trajectories of a Poisson
% process with a given number of jumps
%
% [pjump] = poissonjp(njumps, lambda [, ntraj])
%
% Inputs: njumps - number of jumps to generate in each trajectory
% lambda - arrival intensity
% ntraj - optional, the number of trajectories to
% generate. Default 1.
%
% Outputs: pjump - a matrix with <ntraj> columns of jump times of
% the processes
%
% See also POISSONTI
% Authors: R.Gaigalas, I.Kaj
% v1.2 07-Oct-02
% default parameter values
if (nargin ==2)
ntraj = 1;
end
% generate a sample from Exp(lambda) and sum up
pjump = cumsum(-log(rand(njumps, ntraj))./lambda);
% plot the first process
stairs(pjump(:, 1), [0:njumps-1]);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?