error occurs when using fsolve

1 次查看(过去 30 天)
desword jacky
desword jacky 2015-9-23
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!

回答(1 个)

Kevin Doherty
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by