필터 지우기
필터 지우기

error occurs when using fsolve

조회 수: 3 (최근 30일)
desword jacky
desword jacky 2015년 9월 23일
답변: Kevin Doherty 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에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by