Dear Sirs, how to get points that are in minimum distance from a curve, that was plotted using 100 points, with respect to points of other curve.

조회 수: 1 (최근 30일)
So basically, I have two curves, plotted using 100 points, let's say curve A and curve B. I need to take 100 points from curve A. Then find points on B so they are in minimum distance from selected points on curve A. I had numerous attempts to find those points. I suspect that the problem is that curve B is plotted using known 100 points and there is no information about possible minimum point on curve B. I appreciate if you help me with the issue. Kind regards, John By the way there is a pseudo code what I tried to do 1)import pointsA 2)distance between pointsA and some points B 3)min(distance) So here I need to find the points that give that minimum distance
  댓글 수: 2
Lobini Five
Lobini Five 2016년 10월 12일
I have points on B. Now I made some progress. For curve B I created 1000 points and evaluated only 20 points on A. So amongst 1000 points I can selected 20 points that provide minimum distances.

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

답변 (1개)

Mostafa
Mostafa 2016년 10월 13일
편집: Mostafa 2016년 10월 13일
Assuming the two arrays are of the same size:
values = 0 : pi/100 : 2*pi;
A = cos(values);
B = sin(values);
min_distance = 0.1; %The minimum accepted distance between the two curves
points = (abs(A - B)<= min_distance); %Get the indicies of the corresponding points
B(points); %The points you want in curve B
You can also check 100 elements in A and B by using A(100:199) vs B(100:199) for example.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by