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

1 Kommentar

Rick
Rick am 21 Okt. 2013
btw f1,f2,f3, d1,d2,d3 are constants. I want to maximize for p

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 21 Okt. 2013

0 Stimmen

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.)

2 Kommentare

Rick
Rick am 21 Okt. 2013
I do have the optimization toolbox, but isn't fminbnd for functions of one variable? This is in two; p(1) and p(2)
Yes it is true, for some f's and d's there are an infinite number of identical maxima. What is important for me to find is what the function evaluates to at one of those identical maxima. I can restrict the number of solutions given, correct?
I have ways of knowing, in a few cases, how many maxima there should be for given f's and d's; in fact, when f1=f2=f3=1 and d1=d2=d3=1/3 the function should evaluate to 1.064..., at 6 different identical maxima.
A little background. What I would like to do ultimately, is to loop over f and d on their own intervals, and find the f's and d's (such that f1*d1+f2*d2+f3*d3=1) which give strictly 6 identical maxima and the value this function evaluates to at those points.
I appreciate your help, very much!
Rick
Rick am 21 Okt. 2013
I suppose I could fix, say, p(1) with a loop and maximize for p(2) using fminbnd?

Melden Sie sich an, um zu kommentieren.

Alan Weiss
Alan Weiss am 21 Okt. 2013
Bearbeitet: Alan Weiss am 21 Okt. 2013

0 Stimmen

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.
And to maximize rather than minimize, use the negative of your objective function.
Alan Weiss
MATLAB mathematical toolbox documentation

Kategorien

Mehr zu Optimization Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Okt. 2013

Bearbeitet:

am 21 Okt. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by