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/07/19 07:19:13
![MATLAB:Input argument](/uploads/image/z/5167328-32-8.jpg?t=MATLAB%3AInput+argument+%22x%22+is+undefined+%E7%A8%8B%E5%BA%8F%E5%A6%82%E4%B8%8B%EF%BC%9Afunction+F%3Dfun%28x%29t%3D1%3B+%25+the+time%2Chere+is+one+year+std%3D16000000000%3B+%252011-6-30+short+term+debtltd%3D1.57538e%2B12%3B+%25+long+term+debtdebt%3Dstd%2B0.5%2Altd%3B+%25+debt+valuerf%3D0.03125+%25+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 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 % 没有问题