How to use fminsearch with several parameters in the right way?
11 次查看(过去 30 天)
显示 更早的评论
Hello,
it is the first time that I try use some optimization and somebody told me it is a good idea to use fminsearch?
Aim:
I got a function sumDist = transDist(feat1, feat2, tP) and I want to optimize it:
y = fminsearch (@(x) transDist(this.featP1, this.featP2, x), 0);
0 would be the optimal result of the function but it is like unreachable. x is an vector of size 9 where value 4 to 6 are angles in radians, don't know if i need to limit the value range and how i could do this. As result i would like to get the x vector for the best result fminsearch was able to find.
I hope you can help me a little bit with that.
Thank you in advance.
Greetings,
me
@Edit1 (2016-07-08 08:17:00) fminsearch should be fine but 1 thing I noticed in the first comment is
x0 = zeros(9,1);
but I don't know what a good value for the input could be. I only know that 0 as a result would be the best possible solution for the output. My function calculates a scaling, rotation, transformation in 3D until featP1 fit best to featP2. Could you help me solve this problem, because if this doesn't work I got no Idea how to make it work.
5 个评论
Walter Roberson
2016-7-7
fminsearch does not get "confused" by multiple identical optimum: it just randomly ends up in one of the basins.
Walter Roberson
2016-7-8
If you have no idea what a good starting point is, then you might as well pick a value at random out of the entire range of values possible for that position. For example,
RR = @(A,B) A + rand()*(B-A);
x0 = [RR(-500,750), RR(0, realmax), RR(-pi,pi), RR(-pi,pi), RR(-pi,pi)];
This would construct a vector in which the first element was chosen uniform randomly over (-500,750), the second over (0, 1E+308), and the other three over -pi to +pi.
And then if you don't get a nice result, you can randomly generate again...
采纳的回答
baxbear
2016-7-10
2 个评论
Marc
2016-7-11
This is not an "accepted" answer to the question. Nobody knows what you are looking for because your question was pretty vague. There are well known reasons why a Nelder Mead Simplex approach works and doesn't work. There is also a good reason why The Mathworks Co. sells an Optimaztion and Global Optimaztion toolbox.
Walter Roberson
2016-7-11
The poster Accepted their own Answer, so it was an answer that served their purpose. (It was pretty much the answer the volunteers had described.)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!