where J is the Jacobian of the vactor-valued function F that lsqnonlin requires. (Levenberg-Marquardt is similar.)
In order to compute the step s, the algorithm will need the vector-valued (non-squared) F to form the right hand side in (1), and the Jacobian (whose rows are the gradients of the individual F(i)'s) in both sides of (1).
Nonlinear least square solvers like lsqnonlin exploit the structure of the problem, and need the non-squared version to be able to form and solve the above equation at each iteration.
The function one passes to a nonlinear least squares solver can't be totally arbitrary, it has to be a sum of squares.
Otherwise, for arbitrary scalar functions, one has to call an optimization solver that doesn't assume any structure of the objective, like fmincon, fminsearch, patternsearch, etc.
Sven Knecht wrote: > Hi, > > I'm looking for a nonlinear optimization algorithm to minimize an > arbitrary (nonlinear) objective function within lower and upper > boundaries. More precisely, I want to use the Gauss-Newton and > Levenberg-Marquard algorithm to minimize the euclidean norm of a > distance vector (diff_y) > > obj=((sum(diff_y .^2))/nnodes).^0.5 > > whereas diff_y is a function of two parameters within lb and ub. > Lsqnonlin would solve this nonlinear (least-squares) problem. However > it does only enable to pass a vector-valued function which is summed > and squared internally (does not allow arbitrary functions). And > fsolve with option ('NonlEqnAlgorithm','lm' or 'gn') can not handle > lower and upper boundaries. > > Are there any possibilities to handle this problem in MATLAB? Do I > have to write the code? > > > Thanks in advance, > > Sven