matlab中max怎么用? 5
s0=40;sgm=0.3;r=0.08;symst;T=0.25;x=40;randn('seed',0);fornu=1:1000unt=(r-0.5*sgm^2)*...
s0=40;
sgm=0.3;
r=0.08;
syms t;
T=0.25;
x=40;
randn('seed',0);
for nu=1:1000
unt=(r-0.5*sgm^2)*t;
sit=sgm*sqrt(t);
z=randn(1000,1);
zj=z(nu);
st=s0*exp(unt+sit*zj);
a=int(st,t,0,T);
A=a/T;
cj(nu,1)=exp(-r*t)*max(0,A-x);
end;
[eucall,varprice,ci]=normfit(cj)
这个运行时max总会出错,,0.0 展开
sgm=0.3;
r=0.08;
syms t;
T=0.25;
x=40;
randn('seed',0);
for nu=1:1000
unt=(r-0.5*sgm^2)*t;
sit=sgm*sqrt(t);
z=randn(1000,1);
zj=z(nu);
st=s0*exp(unt+sit*zj);
a=int(st,t,0,T);
A=a/T;
cj(nu,1)=exp(-r*t)*max(0,A-x);
end;
[eucall,varprice,ci]=normfit(cj)
这个运行时max总会出错,,0.0 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询