maximizing a function of 2 variables where coefficients are given by parameters
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
alpedhuez
am 27 Jul. 2020
Kommentiert: alpedhuez
am 28 Jul. 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Jul. 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 Kommentare
Weitere Antworten (1)
Matt J
am 27 Jul. 2020
Bearbeitet: Matt J
am 27 Jul. 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...
Siehe auch
Kategorien
Mehr zu Systems of Nonlinear Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!