|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
Miu_R=100;
Sigma_R=12;
Miu_S=50;
Sigma_S=7.5;
syms R S Ibeta
g=R-S;
R_cos=-diff(g,R).*Sigma_R./sqrt((diff(g,R).*Sigma_R)^2+(diff(g,S).*Sigma_S)^2);
S_cos=-diff(g,S).*Sigma_S./sqrt((diff(g,R).*Sigma_R)^2+(diff(g,S).*Sigma_S)^2);
% Iteration 1
R_star=Miu_R;
S_star=Miu_S;
Arfa_R=subs(R_cos,{R,S},{Miu_R,Miu_S });
Arfa_S=subs(S_cos,{R,S},{Miu_R,Miu_S});
F=50-12.*beta.*Arfa_R+7.5.*beta.*Arfa_S;
beta1=solve(F,beta);
beta_s=beta1(1);
for i=2:1000
R_star=Miu_R-Arfa_R.*beta_s.*Sigma_R;
S_star=Miu_S-Arfa_S.*beta_s.*Sigma_S;
Arfa_S=subs(S_cos,{R,S},{R_star,S_star});
Arfa_R=subs(R_cos,{R,S},{R_star,S_star });
F=50-12.*beta.*Arfa_R+7.5.*beta.*Arfa_S;
beta2=solve(F,beta);
beta(i)=beta2(1);
p=eval(abs(beta(i)-beta_s));
if p>1e-4;
beta_s=beta(i);
break
end
Pf=norminv(-beta(i),0,1);
disp('R_star','S_star','beta2(1)','Pf');
end
Error in ==> d:\MATLAB6p5\work\Untitled3.m
On line 32 ==> Pf=norminv(-beta(i),0,1);
这里一直出错,各位帮帮忙啊.
[ 本帖最后由 eight 于 2007-12-19 15:59 编辑 ] |
|