function discpayoff=blsmc(s0,K,r,time,sigma,Nu)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%蒙特卡洛方法计算欧式看涨期权的价格 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%输入参数
%s0 股票价格
%K 执行价
%r 无风险利率
%sigma 股票波动的标准差
%Nu 模拟的次数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
randn('seed',0);
nuT=(r-0.5*sigma^2).*time;
sit=sigma*sqrt(time);
N=size(time,2);
m=1;
for k=1:N
sT=mean(s0*exp(nuT(m,k)+sit(m,k)*randn(Nu,1)))
discpayoff=exp(-r*time(m,k))*max(0,sT-K);
%期权到期时的现金流
end
end
sT有结果,discpayoff全为零,matlab新手,希望大家给与帮助!!!