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 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Mostafa
on 13 Oct 2016
Edited: Mostafa
on 13 Oct 2016
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.
0 Comments
See Also
Categories
Find more on Interpolation 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!