Clear Filters
Clear Filters

error occurs when using fsolve

3 views (last 30 days)
desword jacky
desword jacky on 23 Sep 2015
Answered: Kevin Doherty on 23 Sep 2015
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!

Answers (1)

Kevin Doherty
Kevin Doherty on 23 Sep 2015
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.

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!