Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Esteban
Posts:
1
Registered:
7/28/14


Nonlinear Root Solver
Posted:
Jul 28, 2014 2:31 PM


After fsolve failed to solve my largescale problem, I switched to ZIB's NLEQ1. However, I'm having some problems with its correct implementation. When I run an illustrative example (posted below), I get the following error:
Output argument "fail" (and maybe others) not assigned during call...
If I specify a value for fail in myfun, I get the following error:
Undefined function or variable "sumxa"...
Would anyone with experience on NLEQ1 be so king to show me how to properly implement it and what these errors mean?
Thanks, EC
 Code:
% Driver: X0 = [0.5;3]; XSC = [1E1;1E1]; PAR = [8;7;4]; FCN = @myfun;
RTOL = 1E12; IOPT = []; WK = [];
[x,info,wk] = nleq1(FCN,X0,XSC,RTOL,IOPT,PAR,WK)
% Function: function [out,fail] = myfun(x,flag,par) c1 = par(1); c2 = par(2); c3 = par(3); if strcmpi('',flag) f = zeros(2,1); f(1) = x(1).^2 + x(2).^2  c1; f(2) = x(1).*x(2) + c2.*x(1)  c3; out = f; elseif strmpi('jacobian',flag) j = zeros(2,2); j(1,1) = 2.*x(1); j(1,2) = 2.*x(2); j(2,1) = x(2) + 7; j(2,2) = x(1); out = j; end end



