How to find optimiazed values of variables that will maximize the function
Show older comments
I have a function "F" with three points in xy-plane (6 variables) x1,y1, x2,y2, and x3,y3. I want to find to the values of these points whe the function will have maximum value over a range for example (-100,-100) to (100,100) in xy-plane. Please guide me how can I do it. Actually, my knowledge about optimization problems is almost zero. Thanks
3 Comments
Walter Roberson
on 22 Sep 2018
It sounds to me as if you have a function of two variables that you want to maximize over a particular range and then evaluate st three particular points?
Or is this a curvefitting task, that you have a function in two, or three or four parameters and two variables, and you have the function value at three particular points and you want to use the given points to find all except one of the parameters and then you want to find the value of the remaining parameter that maximizes the function in the given region?
Denis Perotto
on 22 Sep 2018
Edited: Denis Perotto
on 22 Sep 2018
I can't get, either you want to use these three points to restore y=y(x) function, using interpolation, and then find its maximum, or you have a plane in 3D, restored by three points z=z(x,y), or you have a function F=F(x1,y1,x2,y2,x3,y3) of six variables and want to find its maximum.
Anyway, MATLAB algorithms (for example, 'fminsearch'), search for the minimum value of function without restrictions. You have to:
1. Invert your function like
f1 = L - f
where 'L' is a value, greater than your function maximum. So, you will search for a minimum of 'f1', that will be a maximum for 'f'.
2. Restrict your function, using penalty method, for example,
f1 = f1 + L * (-100 <= x && x <= 100)
Walter Roberson
on 22 Sep 2018
fmincon() and most other minimizers permit supplying upper and lower bounds.
Answers (0)
Categories
Find more on Robust Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!