Minimization of two variables

21 views (last 30 days)
Joshua Woodard
Joshua Woodard on 27 Jun 2019
Commented: infinity on 28 Jun 2019
I cant seem to figure this out on my own. I need to minimize the following function where xi and yi are given data sets (points in 2D),
f(x,y) = minimize{maximize[sqrt((xi-x)^2+(yi-y)^2)]-minimize[sqrt((xi-x)^2+(yi-y)^2)]}
I will need to find x,y.

Accepted Answer

infinity on 27 Jun 2019
Edited: infinity on 27 Jun 2019
Here is an example for your problem, which you can refer
xiyi = [0,1;
-1 2];
x0 = zeros(size(xiyi));
fun = @(x) max(sqrt((x(:,1)-xiyi(:,1)).^2 + (x(:,2)-xiyi(:,2)).^2))...
- min(sqrt((x(:,1)-xiyi(:,1)).^2 + (x(:,2)-xiyi(:,2)).^2));
xsol = fminsearch(fun,x0)
It is assumed that xi and yi are the first and second column of vector xiyi (in the code).
The solution (x,y) will be stored in xsol.
infinity on 28 Jun 2019
In the case of searching only one index, for example,
max(sqrt((x(1,1)-xiyi(1,1)).^2 + (x(1,2)-xiyi(1,2)).^2))...
- min(sqrt((x(1,1)-xiyi(1,1)).^2 + (x(1,2)-xiyi(1,2)).^2))
the usage of max and min functions are not necessary since only one value in these functions. I am still unclear with your description of the problem. You may illustrate by picture, which will be more easy.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!