Hi.I have a function f(x,y)=2.62./2.62+(x-y).^4, based on the attached figure, the minimum value for this function is 1. I want to know among all of the value for x and y that makes f(x,y)=1, what is the minimum of x-y? I mean how can I find the minimum value of x-y from all of the values that make f(x,y)=1.
Thanks in advance for any help
openfig('xy.fig');

댓글 수: 4

x-y is constantly 0 for all values that make f(x,y) = 1.
Maybe you forgot to set brackets in your function definition ?
f(x,y)=2.62./(2.62+(x-y).^4)
instead of
f(x,y)=2.62./2.62+(x-y).^4
?
M
M 2022년 6월 14일
Sorry. it is f(x,y)=2.62./(2.62+(x-y).^4).
Not exactly equall zero for all values, for example if we have x=0.5789 and y=0.525, x-y is not zero but f is 1 in according to the figure,
Walter Roberson
Walter Roberson 2022년 6월 14일
편집: Walter Roberson 2022년 6월 14일
For real x and y, (x-y)^4 is always non-negative. 2.62 plus a non-negative value will always be minimum 2.62 or larger. 2.62 divided by a value that is 2.62 or larger, has a maximum value of 1 and cannot be greater than 1. Imagine for example x=1000 y=0 giving 2.62+1e12 as the denominator, the division is going to give near 1e-11
The plot cannot be for the formula you give. The plot could, however, be for the version of the formula missing the ()
M
M 2022년 6월 14일
yes that's true and I don't want the plot, I want the minimum value of "x-y" that make f=1. The answer that @Image Analyst gave is true, while it is not given the value of x and y, it just determined its column and row

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

 채택된 답변

Image Analyst
Image Analyst 2022년 6월 14일

0 개 추천

Compute your f matrix, then try this
% Find the overall minimum value of f.
minValue = min(f(:)) % Hopefully 1 but maybe not exactly.
% Find where that min value occurs
[minRow, minCol] = find(f == minValue)
Note if the min occurs in more than one element minRow and minCol will be vectors giving all the places where minValue occurs.

댓글 수: 8

M
M 2022년 6월 14일
편집: M 2022년 6월 14일
Many thanks for the answer. Could you please tell me how can I find the value of the row and column that give us?for example in that row and column what is the value of x and y?
farah bouzidi
farah bouzidi 2022년 6월 14일
hello @Image Analyst i really need your help in my project since i saw that you helped many people , i am preparing my final year project and i am out of luck in solving my problem please could you contact me i could'nt find a way
Walter Roberson
Walter Roberson 2022년 6월 14일
Image Analyst cannot be contacted for this purpose. The email address he uses outside of his job is from a service that deletes all messages every few hours; if you did manage to find it, he would never receive the message.
Image Analyst
Image Analyst 2022년 6월 14일
편집: Image Analyst 2022년 6월 14일
@M Not sure what you're asking. You say "at what row and column, what is the value of x and y?" Well x is the column so it's minCol, and y is the row so y is minRow. The matrix value at M(minRow, minColumn) or M(y, x) will be minValue.
M
M 2022년 6월 14일
편집: M 2022년 6월 14일
Yes that's true, I accepted this answer but if it is possible for you, could you please answer the following questions related to this problem?
1-How can I find the min value for the specific region forexample x>y?
2-I calculated the value of "f" for finite points. Is there a way to consider infinite points? For example, instead of the phrase below, use a code that gives us more integrated intervals?
x= linspace(0.1, 0.8, 20);
mask = x > y;
minf = min(f(mask));
[row, col] = find(f == minf & mask);
sympref(FloatingPointOutput=false);
syms x y
f(x,y) = 2.62./(2.62+(x-y).^4)
f(x, y) = 
dfx = diff(f, x)
dfx(x, y) = 
critx = solve(dfx, x)
critx = 
%so every y is a triple critical point for x
dfy = diff(f, y)
dfy(x, y) = 
crity = solve(dfy, y)
crity = 
%so every x is a critical point for some y
d2f = simplify(diff(dfx, x))
d2f(x, y) = 
[N, D] = numden(d2f)
N(x, y) = 
D(x, y) = 
xsaddle = solve(N == 0, x)
xsaddle = 
vpa(simplify(subs(f, x, xsaddle)))
ans(x, y) = 
vpa(simplify(subs(f, x, xsaddle - 1/1000)))
ans(x, y) = 
vpa(simplify(subs(f, x, xsaddle + 1/1000)))
ans(x, y) = 
So the first two critical point xsaddle are maximums, the second and third critical points are places where greater or lower would lead to imaginary outputs; the last two are again maxima.
fsurf(f, [-2 2 -2 2])
Looks to me as if there is a "crease".
M
M 2022년 6월 15일
Many thanks @Walter Roberson, it is very helpful and I also learned something new through your code

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2022년 6월 14일

0 개 추천

For the revised formula over real numbers the minimum value is when x and y differ as much as possible, in particular if the difference between them is infinite, which would give you an output of 0.
The maximum value occurs when (x-y)^4 is minimal which occurs when x == y exactly, which gives you 2.62/2.62 == 1

댓글 수: 2

M
M 2022년 6월 14일
I should mention that x and y have this feature that x is larger than y, which means they are never equal. So may be someone says with this condition "f" can't be 1 in this case, but very close to 1 is also acceptable.
Torsten
Torsten 2022년 6월 14일
Choose x as close to y as you can - then f will be as close to 1 as it can.

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

tharun
tharun 2023년 10월 26일

0 개 추천

Find the minimum value f(x,y) = x3 + y 3 subject to the constraints x + y = 20

댓글 수: 3

tharun
tharun 2023년 10월 26일
answer needed
Walter Roberson
Walter Roberson 2023년 10월 26일
When you have an equality constraint relating x and y, solve the constraint for one of the variables, getting a formula for it in terms of the other variable. Then substitute that formula into the main function. You now have a function of a single variable to be optimized. Proceed by way of calculus.
Sam Chak
Sam Chak 2023년 10월 26일
편집: Sam Chak 2023년 10월 26일
Minimize a bivariate function
subject to constrained ,
can be transformed into an unconstrained optimization problem by taking the substitution method:
This yields ,
and the minimum of the quadratic function can be found at
.
From the equality constraint, we can find .

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

M
M
2022년 6월 14일

편집:

2023년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by