Code covered by the BSD License  

Highlights from
Monte Carlo simulations using MATLAB

image thumbnail

Monte Carlo simulations using MATLAB

by

 

11 Dec 2007 (Updated )

Demonstrations of Monte Carlo simulations in MATLAB

BlsMCAV(S0,X,r,T,sigma,NRepl)
% BlsMC.m
function [Price, CI] = BlsMCAV(S0,X,r,T,sigma,NRepl)
nuT = (r - 0.5*sigma^2)*T;
siT = sigma * sqrt(T);
Veps = randn(NRepl,1);
Payoff1 = max( 0 , S0*exp(nuT+siT*Veps) - X);
Payoff2 = max( 0 , S0*exp(nuT+siT*(-Veps)) - X);
DiscPayoff = exp(-r*T) * 0.5 * (Payoff1+Payoff2);
[Price, VarPrice, CI] = normfit(DiscPayoff);

Contact us