跳跃扩散的欧式期权模拟
function p2=rp2(st,r,q,T,t,ru,u,deta1,deta2,K)ru1=ru*exp(u+0.5*deta2^2);
k1=exp(u+0.5*deta2^2)-1;
for i=0:25
d12=(log(st/K)+(r-q-ru*k1-0.5*deta1^2)*(T-t)+i*u)/sqrt((T-t)*deta1^2+i*deta2^2);
a12(i)=poisspdf(i,ru*(T-t))*normcdf(d12,0,1);
end
e12=sum(a12);
g2=exp(-r*(T-t))*K*e12;
for i=0:25
d11=(log(st/K)+(r-q-ru*k1+0.5*deta1^2)*(T-t)+i*(u+deta2^2))/sqrt((T-t)*deta1^2+i*deta2^2);
a11(i)=poisspdf(i,ru1*(T-t))*normcdf(d11,0,1);
end
e11=sum(a11);
g1=exp(-q*(T-t))*st*e11;
g3=g1-g2;
end