error occurs when using fsolve

1 visualización (últimos 30 días)
desword jacky
desword jacky el 23 de Sept. de 2015
Respondida: Kevin Doherty el 23 de Sept. de 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!

Respuestas (1)

Kevin Doherty
Kevin Doherty el 23 de Sept. de 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.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by