how to find the minimum value of the function of two variables with contour plot?

조회 수: 9 (최근 30일)
How to find minimum value of the function below? I was able to make the contour plot but unable to get the min value using the fminsearch. It kept giving error message when I tried to get the min value. Below is the function and the contour I tried:
x = linspace(0.5,6);
y = linspace(0.5,6);
[X,Y] = ndgrid(x,y);
Q2 = 4.74/4*(3*exp(-2.054*(X-1.401))-2*exp(-1.027*(X-1.401)));
Q1 = 4.74/4*(3*exp(-2.054*(Y-1.401))-2*exp(-1.027*(Y-1.401)));
Q3 = 4.74/4*(3*exp(-2.054*(X+Y-1.401))-2*exp(-1.027*(X+Y-1.401)));
J2 = 4.74/4*(-exp(-2.054*(X-1.401))+6*exp(-1.027*(X-1.401)));
J1 = 4.74/4*(-exp(-2.054*(Y-1.401))+6*exp(-1.027*(Y-1.401)));
J3 = 4.74/4*(-exp(-2.054*(X+Y-1.401))+6*exp(-1.027*(X+Y-1.401)));
Z = 0.904.*(Q1+Q2+Q3-(sqrt(0.5.*((J2-J1).^2+(J1-J3).^2+(J3-J2).^2))));
contour(X,Y,Z,100,'black');
  댓글 수: 5
Sophia Sagala
Sophia Sagala 2019년 3월 21일
Can you please explain me how did you get the minima at X = 1.863 with that corresponding value? What code did you use? I did substitute Y = X.
Thanks before.
Walter Roberson
Walter Roberson 2019년 3월 21일
fminsearch() is enough to get this result. The exact solution is X =
-(1000*ln(3))/1027 - (1000*ln(5))/1027 + (1000*ln((7*exp(1438827/1000000) + 4)*(343*exp(4316481/1000000) + 588*exp(1438827/500000) + 30*exp(1438827/2000000)*sqrt(343*exp(4316481/1000000) + 588*exp(1438827/500000) + 1011*exp(1438827/1000000) + 64)*sqrt(3) + 1686*exp(1438827/1000000) + 64)^(1/3) + 49*exp(1438827/500000) + 56*exp(1438827/1000000) + (343*exp(4316481/1000000) + 588*exp(1438827/500000) + 30*exp(1438827/2000000)*sqrt(343*exp(4316481/1000000) + 588*exp(1438827/500000) + 1011*exp(1438827/1000000) + 64)*sqrt(3) + 1686*exp(1438827/1000000) + 64)^(2/3) + 16))/1027 - (1000*ln(343*exp(4316481/1000000) + 588*exp(1438827/500000) + 30*exp(1438827/2000000)*sqrt(343*exp(4316481/1000000) + 588*exp(1438827/500000) + 1011*exp(1438827/1000000) + 64)*sqrt(3) + 1686*exp(1438827/1000000) + 64))/3081
which I found with Maple.

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

답변 (1개)

KSSV
KSSV 2019년 3월 21일
[c,h] = contour(X,Y,Z,'showtext','on');
min(h.LevelList)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by