全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
3843 1
2009-02-02


cp=8.08;
vol=0.5075;
rate=0.0414;
T=3;
X=8.4;
N=100;
dt=T/N;
up=exp(vol*sqrt(dt));
down=1/up;
p=(exp(rate*dt)-down)/(up-down);
s=zeros(N,N);
v=zeros(N,N);
p=zeros(N,N);
for n=0:N-1;
      for j=0:n;
      s(n+1,j+1)=cp*(up)^(n-j)*(down)^j;
      end;
end;
for j=N:-1:1;
       v(N,j)=max(s(N,j)-X,0);
end;
 for i=N-1:-1:1;
       for j=i:-1:1;
       H=(1-p)*(v(i+1,j+1))/(1+rate*dt)+p*(v(i+1,j))/(1+rate*dt);
       v(i,j)=max(s(i,j)-X,H);
     end;
end;

???  In an assignment  A(matrix,matrix) = B, the number of rows in B
and the number of elements in the A row index matrix must be the same.

有高手知道程序怎么修改么 ,谢谢了。

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-2-11 13:06:00

v(i,j)=max(s(i,j)-X,H);

错了,你help一下max的用法

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群