Code covered by the BSD License
-
birthdeath(npoints, flambda, ...
BIRTHDEATH generate a trajectory of a birth-death process
-
bm3plot(npoints, sigma)
% BM3PLOT Generate and plot a 3-dimensional Brownian motion
-
brownian(npoints, sigma)
BROWNIAN generate and plot an aproximation to Brownian motion.
-
galtonwatson(nmbgen, initsize...
GALTONWATSON generates a trajectory of a Galton-Watson branching process
-
moran(initsize, popsize)
MORAN generates a trajectory of a Moran type process
-
poisson2d(lambda)
POISSON2D generate and plot Poisson process in the plane
-
poisson3d(lambda)
POISSON3D generate and plot Poisson process in the unit cube
-
poissonjp(njumps, lambda, ntr...
POISSONJP generate and plot a number of trajectories of a Poisson
-
poissonti(tmax, lambda, nproc...
POISSONTI generate N independent Poisson processes as matrix
-
ranwalk(npoints, p)
RANWALK generate and plot a trajectory of a random walk which
-
ranwalk2d(npoints, p)
-
ranwalk3d(npoints, p)
-
rw3plot(npoints, ntrajs, p)
RW3PLOT generate and plot some trajectories of the process
-
View all files
from
Simulation of Stochastic Processes
by Ingemar Kaj Raimundas Gaigalas
Simulates and plots trajectories of simple stochastic processes.
|
| poissonti(tmax, lambda, nproc)
|
function [tarr, pcount] = poissonti(tmax, lambda, nproc)
% POISSONTI generate N independent Poisson processes as matrix
% columns
%
% [tarr] = poissonti(tmax, lambda [, nproc])
%
% Inputs: tmax - time window
% lambda - arrival intensity
% nproc - optional, the number of processes to
% generate. Default 1.
%
% Outputs: tarr - a matrix with <nproc> columns of arrrival times of
% the processes
%
% See also POISSONJP
% Authors: R.Gaigalas, I.Kaj
% v1.3 Created 07-Oct-02
% Modified 02-Dec-05 Changed the names of variables, added the
% counting process, truncation at tmax
% default parameter values
if (nargin ==2)
nproc = 1;
end
% add zero to the arrival times for nicer plots
tarr = zeros(1, nproc);
% sums of exponentialy distributed interarrival times
% as matrix columns
i = 1;
while (min(tarr(i,:))<=tmax)
tarr = [tarr; tarr(i, :)-log(rand(1, nproc))/lambda];
i = i+1;
end
% cut off arrival times greater than tmax
ex_i = find(tarr>tmax);
tarr(ex_i) = tmax;
% generate the jumps of counting processes as matrix columns;
% do not add up as yet since we don't want values for times
% greater than tmax
pcount = [zeros(1, nproc); ones(size(tarr, 1)-1, nproc)];
% set the counts of the exceeding times to zero
pcount(ex_i) = 0;
% add up the jumps
pcount = cumsum(pcount);
% plot the counting processes
stairs(tarr, pcount);
|
|
Contact us at files@mathworks.com