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.

 채택된 답변

infinity
infinity 2019년 6월 27일
편집: infinity 2019년 6월 27일

0 개 추천

Hello,
Here is an example for your problem, which you can refer
clear
xiyi = [0,1;
1,3;
-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.

댓글 수: 3

Joshua Woodard
Joshua Woodard 2019년 6월 28일
This answers my question, but leads me to one more question. Are the colons acting as 1,2,3,4,5...,n ? Or, are they allowing the search to be independent? Said in another way, are the colons allowing the search to pick any index independently (not all : acting as 1,2,3... together). I would like it to analyze any row in my data set in any combination.
Joshua Woodard
Joshua Woodard 2019년 6월 28일
I am looking for an x and y that is the center of two concentric circles where the zone of the two circles contain the data. One circle is bigger and contains all the data whereas the small circle does not. I am maximizing the small circle and minimizing the big circle.
Hello,
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.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품

질문:

2019년 6월 27일

댓글:

2019년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by