Maximizing using fminsearch over an interval
古いコメントを表示
I want to maximize
(((cos(p(1))*sin(p(2)))-(f1*(cos(p(1))*sin(p(2)))+f2*(sin(p(1))*sin(p(2)))+f3*cos(p(2)))*d1)^4+((sin(p(1))*sin(p(2)))-(f1*cos(p(1))*sin(p(2))+f2*sin(p(1))*sin(p(2))+f3*cos(p(2)))*d2)^4+((cos(p(2)))-(f1*cos(p(1))*sin(p(2))+f2*sin(p(1))*sin(p(2))+f3*cos(p(2)))*d3)^4)^(1/4);
for p(1) from -pi..pi and p(2) from -2pi..2pi
Is there a way to restrict the input to an interval?
TIA
回答 (2 件)
Walter Roberson
2013 年 10 月 21 日
0 投票
No. If you have an interval use fminbnd() or related if you have the Optimization toolbox; if you do not have that toolbox then use fzero() on the derivative of the function if it is a function of one variable.
If you do not have the optimization toolbox and it is a function of more than one variable, you might be able to get somewhere using the Symbolic Mathematics Toolbox.
It appears to me that there are multiple identical maxima in the range you specify. Depending on the parameters I use, I find 8, or 12, or maybe an infinite number (I'm still processing that case to see if there is a subtle wave that I do not see visually.)
Alan Weiss
2013 年 10 月 21 日
編集済み: Alan Weiss
2013 年 10 月 21 日
0 投票
If you use the optimization decision table for your nonlinear problem with bound constraints, you see that you should use fmincon as your solver. It is easy to set a range for fmincon, just give lower and upper bounds.
Alan Weiss
MATLAB mathematical toolbox documentation
カテゴリ
ヘルプ センター および File Exchange で Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!