Selecting the correct solver for minimization

1 view (last 30 days)
Axel
Axel on 23 Nov 2011
Hi,
I'm trying to minimize an expression, which could look something like this: E(x,y) = sum (x_a - x_b)^2 + (y_a - y_b)^2
I guess I should use a least square solver, but how should how should I format the vector valued function? It should not output the squared error and it would be wrong to output the sum of (x_a -x_b) + (y_a - y_b). Should I instead stack the output of (x_a -x_b) and (y_a - y_b)? This will give me double the size of elements summed over. Is this problematic? Or should I use a different solver than least square solver.
The problem I'm trying to solve, is similar to estimating the Essential matrix found in Computer Vision.
Thanks in advance

Answers (1)

Alan Weiss
Alan Weiss on 30 Nov 2011
I'm not sure what your decision variables are, and what variables are outside your control. Perhaps you can use lsqnonlin. http://www.mathworks.com/help/toolbox/optim/ug/lsqnonlin.html In the documentation, x represents a vector of variables that lsqnonlin can modify to search for a minimum. lsqnonlin attempts to minimuze a sum of squares of a vector function f(x).
Read the syntax carefully: lsqnonlin expects a vector function f(x), NOT a sum of squares f(1)^2 + f(2)^2 + ...
  2 Comments
Axel
Axel on 30 Nov 2011
I'm aware of that lsqnonlin expects a vector output function. What I am asking, is what do I do, when it is not strictly a sqarred error problem.
I can't really output a single value for f(1), so I'm wondering, if I can stack two outputs for f(1) and so forth.
So my output becomes something like:
f(1)(1)
f(1)(2)
f(2)(1)
f(2)(2)
...
f(n)(1)
f(n)(2).
I tried this solution, and the error is minimized. But I am unsure if it is the correct error measure, that is minimized.
Steve Grikschat
Steve Grikschat on 13 Dec 2011
It's difficult for me to follow. Can you define what f(1), f(2), etc., are? Perhaps a snippet of code would be helpful.
Also, you have a measure of error that you want to minimize (E(x,y), listed in the original post). Does that match what you get from lsqnonlin?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!