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

9 views (last 30 days)
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 Comments
Sophia Sagala
Sophia Sagala on 21 Mar 2019
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 on 21 Mar 2019
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.

Sign in to comment.

Answers (1)

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

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!