How to use fminbnd but with multiple variables
Mostra commenti meno recenti
I have a function of multiple variables defined in a specified range. They can be even vectors. I want to find the minimum of a function in that interval. The simplified example is the following:
X1=[0.001 0.5];
X2=[1 1]; %with this i mean that L1 must be in the range of 0.001 and 1, while C1 in the range of 0.5 and 1
f=@(L1,C1)sqrt(1/(L1*C1));
[X,Y]=fminbnd(f,X1,X2)
Naturally here it doesn't work. Is there a possible alternative solution to this problem? Thanks in advance
Risposta accettata
Più risposte (1)
Torsten
il 15 Lug 2023
1 voto
In the case above, your objective function is separable in the optimization variables. Thus you can solve two independent problems using "fminbnd" and multiply the results.
For more difficult cases, use "fmincon".
2 Commenti
Be careful about the assumption that the minimum of the product of two functions, solved independently is the global minimum.
Consider the function
syms x y
Fx = (x^2 - 1);
Fy = (y^2 + 4*y - 4);
fplot(Fx)
hold on
fplot(Fy)
hold off
grid on
And, clearly, Fx has a minimum at x==0, and Fy has a minimum at y==-2.
solve(diff(Fx) == 0)
solve(diff(Fy) == 0)
However, is the product of those two functions a minimum at the point (0,-2)? No. In fact, that point is a local MAXIMUM, and the product of the two functions is unbounded from below.
Fxy = Fx*Fy;
fsurf(Fxy,[-3,3 -3,3])
Torsten
il 15 Lug 2023
I assumed the function to be separable (as in the case given):
F(x,y) = f1(x) * f2(y)
I forgot to add that f1,f2 should be >=0, but this is also true for the example given.
Categorie
Scopri di più su Surrogate Optimization in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

