Selecting the correct solver for minimization
Mostrar comentarios más antiguos
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
Respuestas (1)
Alan Weiss
el 30 de Nov. de 2011
0 votos
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 comentarios
Axel
el 30 de Nov. de 2011
Steve Grikschat
el 13 de Dic. de 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?
Categorías
Más información sobre Choose a Solver en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!