Re: lsqnonlin - any difference for myfunc() to return vector or norm(vector)^2 ?
- From: spasmous <spasmous@xxxxxxxxx>
- Date: Tue, 29 Jan 2008 14:50:45 -0800 (PST)
On Jan 18, 7:22 pm, John D'Errico <woodch...@xxxxxxxxxxxxxxxx> wrote:
In article <07901b77-0ea0-49cb-ad2b-1af5f3f09...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,spasmous<spasm...@xxxxxxxxx> wrote:
I am doing a minimization using lsqnonlin. There are 5 unknowns and 10
measurements. The documentation says to return a vector of residuals
but I prefer to return the sum of squares error - is there any
material difference? It seems happy, even though there is nominally
only one residual value and 5 unknowns.
Yes, there is clearly a difference. Since lsqnonlin
will form the sum of squares of the VECTOR that it
expects to see, then minimize that, if you return
only a scalar quantity, it will produce a different
result. At the very least it will be far less
accurate, since you are squaring a square.
Were you working in infinite precision, the minimizer
of the sum of squares should be the same as the
minimizer of the square of the sum of squares. But
why do it?
John
Actually a real reason - for my problem I am seeing the error message:
?? Error using ==> unknown
Maximum variable size allowed by the program is exceeded.
Error in ==> optim\private\nlsq at 115
JACFD = zeros(nfun, numberOfVariables); ü·¢xPet to correct
size
The number of unknowns is 130 000 and the number of measurements is
500 000. It can't make a Jacobian that size so I am norming the
residual vector... sadly lsqnonlin doesn't seem to minimize the norm
of the residual very well like this.
Currently I'm trying fminsearch since it only wants norm(residual)^2
but I'm not hopeful about simplex on this problem.
.
- References:
- Prev by Date: locate not empty cell between empty cells
- Next by Date: Re: locate not empty cell between empty cells
- Previous by thread: Re: lsqnonlin - any difference for myfunc() to return vector or norm(vector)^2 ?
- Next by thread: Java getResource() problem with matlab
- Index(es):
Relevant Pages
|