Code covered by the BSD License  

Highlights from
Approaches to implementing Monte Carlo methods in MATLAB

image thumbnail

Approaches to implementing Monte Carlo methods in MATLAB

by

 

28 Sep 2011 (Updated )

Code for the article in the September 2011 article http://www.wilmott.com/magazine.cfm

TimingScriptSDE.m
% Timing script to test time taken for scripts using different SDE
% approaches
%
% See article "Approaches to implementing Monte Carlo methods in MATLAB"
% by Sri Krishnamurthy,CFA and Jorge Paloschi,PHD
% in the September 2011 article of Wimott Magazine or at
% http://www.wilmott.com/magazine.cfm 
%
% Copyright 2011 MathWorks, Inc.
tStart=tic;
[P1 Sig1]=PriceArithmeticAsianOptionSDE(50,50,.1,5/12,.4,150,10000);
tElapsed1 = toc(tStart);

tStart=tic;
[P2 Sig2]=PriceArithmeticAsianOptionSDEAntiThetic(50,50,.1,5/12,.4,150,10000);
tElapsed2 = toc(tStart);

tStart=tic;
[P3 Sig3]=PriceArithmeticAsianOptionSDESolution(50,50,.1,5/12,.4,150,10000);
tElapsed3 = toc(tStart);

tStart=tic;
[P4 Sig4]=PriceArithmeticAsianOptionSDEZ(50,50,.1,5/12,.4,150,10000);
tElapsed4 = toc(tStart);

bar([tElapsed1 tElapsed2 tElapsed3 tElapsed4]);
xlabel('Test cases');
ylabel('Time in seconds');

Contact us