Gamma Process

%Assign parameters

nsteps=250; expiry=1; dt=expiry/nsteps;

alphaG=5; lambdaG=10; nsimul=10

%1. Simulate increments of the Gamma process:

dG=gamrnd(dt*alphaG,1/lambdaG,[nsteps,nsimul]);

%2. Simulate Gamma process (use cumulative sum of the increments):

cdG=[zeros(1,nsimul); cumsum(dG)];

%3. Make a plot

h=figure('Color',[1 1 1])

plot([0:nsteps]*dt,cdG)

print(h,'-dpng','Fig_gammaprocess')