Selecting the correct solver for minimization
显示 更早的评论
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
回答(1 个)
Alan Weiss
2011-11-30
0 个投票
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 个评论
Axel
2011-11-30
Steve Grikschat
2011-12-13
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?
类别
在 帮助中心 和 File Exchange 中查找有关 Choose a Solver 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!