error occurs when using fsolve
1 回表示 (過去 30 日間)
古いコメントを表示
This is my function
function F = fun(x)
dfdx(1) = - 9007199254740992/(93649721522480385*(x(1) - 1)) - 36028797018963968/(93649721522480385*x(1));
dfdx(2) = - 72057594037927936/(468248607612401925*(x(2) - 1)) - 36028797018963968/(156082869204133975*x(2));
dfdx(3) = (- 31525197391593472/(468248607612401925*(x(3) - 1)) - 4503599627370496/(156082869204133975*x(3)));
after execute the "fsolve" function, error occurs
>> y = fsolve('fun',[0.000001 0.000001])
Error using feval
Output argument "F" (and maybe others) not assigned during call to "C:\Program
Files\MATLAB\R2013a\bin\fun.m>fun".
Error in fsolve (line 218)
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
Is it means that fsolve can not solve this function ? Thanks a lot!
0 件のコメント
回答 (1 件)
Kevin Doherty
2015 年 9 月 23 日
Your error says "Output argument F not assigned". Your function, "fun" is defined as having an output, which you call F. However, F is not defined anywhere within fun. You have defined dfdx though. This is what you are trying to solve, so this must be your output argument.
Also, you have another problem. Your input vector, x, has three components. However, your initial guess for it, [0.000001, 0.000001], only has two.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!