MATLAB:Input argument "x" is undefined 程序如下:function F=fun(x)t=1; % the time,here is one year std=16000000000; %2011-6-30 short term debtltd=1.57538e+12; % long term debtdebt=std+0.5*ltd; % debt valuerf=0.03125 % risk free interest rateequi
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 13:50:12
MATLAB:Input argument "x" is undefined 程序如下:function F=fun(x)t=1; % the time,here is one year std=16000000000; %2011-6-30 short term debtltd=1.57538e+12; % long term debtdebt=std+0.5*ltd; % debt valuerf=0.03125 % risk free interest rateequi
MATLAB:Input argument "x" is undefined
程序如下:function F=fun(x)
t=1; % the time,here is one year
std=16000000000; %2011-6-30 short term debt
ltd=1.57538e+12; % long term debt
debt=std+0.5*ltd; % debt value
rf=0.03125 % risk free interest rate
equity=1.0509e+011; %equity value
stdy=0.2045; %yearly volatility
d1=(log(x(1))/debt+(rf+0.5*x(2)^2)*t)/(x(2)*sqrt(t));
d2=d1-x(2)*sqrt(t);
r=exp(-rf*t); % risk free discount rate
nd1=normcdf(d1);
nd2=normcdf(d2);
F=[-stdy+nd1*x(1)*x(2)/equity;x(1)*nd1-debt*r*nd2-equity];
运行之后结果是 Input argument "x" is undefined.
Error in ==> fan at 12
d1=(log(x(1))/debt+(rf+0.5*x(2)^2)*t)/(x(2)*sqrt(t));
MATLAB:Input argument "x" is undefined 程序如下:function F=fun(x)t=1; % the time,here is one year std=16000000000; %2011-6-30 short term debtltd=1.57538e+12; % long term debtdebt=std+0.5*ltd; % debt valuerf=0.03125 % risk free interest rateequi
% 这是一个函数,把它保存为 fun.m 后再调用.
>> x=[1 2];
F=fun(x)
F =
1.0e+11 *
-0.0000
-2.3164 % 没有问题