原方程关系式如下:
已知
a(1)=E即公司股权的价值; a(2)=DB即违约距离;a(3)=σE上市公司股权的波动率。
求解
x(1)=VA;x(2)=σA
%首先新建函数
function F= myfun(x)
a(1)=4.489850237*(10^9);a(2)=0.99633839*(10^9);a(3)=0.474561615;
a=[a(1);a(2);a(3)];
F=[a(1)-x(1)*normcdf((log(x(1)/a(2))+0.025+x(2)*x(2)/2)/x(2))+a(2)*(exp(-0.025))*normcdf((log(x(1)/a(2))+0.025-x(2)*x(2)/2)/x(2));x(1)*x(2)*normcdf((log(x(1)/a(2))+0.025+x(2)*x(2)/2)/x(2))-a(1)*a(3)];
然后在命令窗口里面:
>> x0=[5;0.4];options=optimset('display','iter');
>> [x,fval]=fsolve(@myfun,x0,options)
结果是:
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 3 2.46987e+019 0 1
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
x =
5.0000
0.4000
fval =
1.0e+009 *
4.4899
-2.1307
这个结果本来就有点奇怪,而且试了几次发现他解出来的x的结果总是等于设置的初值。我用的是MATLAB(R2010b),由于10月就要交论文初稿了,这个计算涉及我的基础数据的获得,求不出来后面也没法进行下去,有点着急,求助大神,麻烦帮我看一下,前面编写代码的过程是不是有什么错误,本人感激不尽!!!


雷达卡




京公网安备 11010802022788号







