Maximizing using fminsearch over an interval
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
Respuestas (2)
Walter Roberson
el 21 de Oct. de 2013
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
el 21 de Oct. de 2013
Editada: Alan Weiss
el 21 de Oct. de 2013
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
0 comentarios
Ver también
Categorías
Más información sobre Optimization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!