maximizing a function of 2 variables where coefficients are given by parameters

조회 수: 3 (최근 30일)
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
alpedhuez
alpedhuez 2020년 7월 27일
F(x,y)=(a1+a2-y)*y^{2n-2}+(a1-(x+y)/2)*(x^{2n-2}-y^{2n-2})+(a1-x)*(1-x^{2n-2})
where a1, a2, and n are given parameters. I want to sovel x and y that maximize F(x,y) given a1, a2, and n.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 7월 28일
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.)

추가 답변 (1개)

Matt J
Matt J 2020년 7월 27일
편집: Matt J 2020년 7월 27일
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...

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by