请问 批量求解 两变量两方程的方程组的下列代码错在哪里。
Afficher commentaires plus anciens
函数:
function f= BSsolve(x,y)
Price=xlsread('Option.xlsx',1,'A2:A76');
Rate=xlsread('Option.xlsx',1,'C2:C76');
Volatility=xlsread('Option.xlsx',1,'E2:E76');
Value=xlsread('Option.xlsx',1,'F2:F76');
Delta=xlsread('Option.xlsx',1,'G2:G76');
f=[blsprice(Price,x,Rate, y,Volatility)-Value;
blsdelta(Price,x,Rate, y,Volatility)-Delta];
end
命令:
>> x0=xlsread('Option.xlsx',1,'H2:H76');
>> y0=xlsread('Option.xlsx',1,'I2:I76');
>> options=optimset('display','iter','MaxFunEvals',3000);
>> [x,fval]=fsolve(@BSsolve,x0,y0,options)
结果显示出错:
Undefined function 'lt' for input arguments of type 'struct'.
Error in blscheck (line 84)
if any(Time(:) < 0)
Error in blsprice (line 96)
blscheck(S, X, r, T, sig, q);
Error in BSsolve (line 9)
f=[blsprice(Price,x,Rate, y,Volatility)-Value;
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
对于结果有些疑问,Undefined function 'lt'是说lt没定义吗?我整个过程里好像没有lt?
另外,请问整体的求解思路错在了哪里?谢谢!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 数学 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!