⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exppayoff.m

📁 Numerical Methods In_Finance And Economics Matlab Source Code
💻 M
字号:
% exercise 11, chapter 13, from Luenberger, Investment Science
function ExpPayoff = L11(premium,S0,K,r,sigma,T,N)
deltaT = T/N;
u=exp(sigma * sqrt(deltaT));
d=1/u;
p=(exp(r*deltaT) - d)/(u-d);
lattice = zeros(N+1,N+1);
for i=0:N
   if (S0*(u^i)*(d^(N-i)) >= K)
      lattice(i+1,N+1)=S0*(u^i)*(d^(N-i)) - K - premium;
   end
end
for j=N-1:-1:0
   for i=0:j
      lattice(i+1,j+1) = p * lattice(i+2,j+2) + (1-p) * lattice(i+1,j+2);
   end
end
ExpPayoff = lattice(1,1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -