maximizing a function of 2 variables where coefficients are given by parameters
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
alpedhuez
le 27 Juil 2020
Commenté : alpedhuez
le 28 Juil 2020
I have a function of two variables x and y where coefficients are given by paramter a and b. I want to take FOC of this function with respect to x and y and want to find the value of x and y that gives the function the maximium value given a and b. Is it possible to do this operation in Matlab?
6 commentaires
Réponse acceptée
Walter Roberson
le 28 Juil 2020
Once n is given, it seems possible to find an expression for y in terms of roots of a polynomial of degree (2*n-2)^2 . Because that is even degree, it is guaranteed that there will be an even number of complex roots -- and my experiments show that it is possible for there be two positive roots that are relatively close together. You would have to find all the real roots and test them to see which produced the maximum.
You are not going to be able to find closed form solutions for x and y in terms of symbolic a1, a2, and n.
Finding the polynomial of degree (2*n-2)^2 that expresses the root is not easy, and unless you were using a really low degree MATLAB probably cannot find it for you (there are some other programs that seem to be able to find it on a case-by-case basis.)
0 commentaires
Plus de réponses (1)
Matt J
le 27 Juil 2020
Modifié(e) : Matt J
le 27 Juil 2020
You can use fminunc, for example, which would do this for you implicitly. Or, you can write down the first order optimality conditions as equations and solve them with fsolve. Or you could try to solve them analytically with solve() in the Symbolic Toolbox.
Since you have only 2 unknowns, you might consider using fminsearch, which doesn't require any extra toolboxes, but that doesn't employ first derivative conditions, in case that actually matters...
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!