|
楼主 |
发表于 2008-5-3 09:06
|
显示全部楼层
题目如图,要求A和sigmaA,我把d1和d2也当成变量,
然后解含4个变量A、sigmaA、d1、d2的方程组,代码如下
r = 3.66/100; T = 1; E = 1514805.9; DPT = 527691.645; sigmaE = 0.195995;
for k = 1:length(E)
f1 = ['[log(A/' num2str(DPT(k)) ')+(' num2str(r) '+0.5*sigmaA^2)*' num2str(T) ']/(sigmaA*' num2str(sqrt(T)) ')-d1=0'];
f2 = ['d1-sigmaA*' num2str(sqrt(T)) '-d2=0'];
f3 = ['A*normcdf(d1,0,1)-' num2str(DPT(k)) '*exp(-' num2str(r) '*' num2str(T) ')*normcdf(d2,0,1)-' num2str(E(k)) '=0'];
f4 = ['A/' num2str(E(k)) '*normcdf(d1,0,1)*sigmaA - ' num2str(sigmaE(k)) '=0'];
[d1 d2 A sigmaA] = solve(f1,f2,f3,f4,'d1,d2,A,sigmaA'), pause
end
求解的结果如下:
Warning: Explicit solution could not be found.
> In D:\MATLAB6p5\toolbox\symbolic\solve.m at line 136
In d:\MATLAB6p5\work\shenjian\data\data.m at line 73
d1 =
[ empty sym ]
d2 =
[]
A =
[]
sigmaA =
[]
请各位高手指教,谢谢,:@D
[ 本帖最后由 ChaChing 于 2010-7-30 14:30 编辑 ] |
-
题目
|