I have some point and one line.

2 次查看(过去 30 天)
I have some point and one line.
my points are in (x,y) written in under
X = ...
[ 1 1
1 3
1 5
1 7
1 9
1 11
1 13
1 15
1 17
3 1
3 3
3 5
3 7
3 9
3 11
3 13
3 15
3 17
5 1
5 3
5 5
5 7
5 9
5 11
5 13
5 15
5 17
7 1
7 3
7 5
7 7
7 9
7 11
7 13
7 15
7 17
9 1
9 3
9 5
9 7
9 9
9 11
9 13
9 15
9 17
11 1
11 3
11 5
11 7
11 9
11 11
11 13
11 15
11 17
13 1
13 3
13 5
13 7
13 9
13 11
13 13
13 15
13 17
15 1
15 3
15 5
15 7
15 9
15 11
15 13
15 15
15 17
17 1
17 3
17 5
17 7
17 9
17 11
17 13
17 15
17 17];
and my line is
r=[0 10 15 20 30];
t=[10 10 15 10 10];
f= line(r,t)
how can i find wich points are under the line??
please help me its emergency
  2 个评论
David Welling
David Welling 2020-4-19
Since there is only a small number of cases, you could do it by hand, especially since the line is so simple.
plot the line and the points and you will see it easily.
for a more general case using arbitrary points and lines, I suggest interpolating to find the y value of the line for a given x of the point, and then comparing y_line and y_point
Mili Kian
Mili Kian 2020-4-20
these points were for example. in fact i have more than a hundread points.

请先登录,再进行评论。

采纳的回答

Ameer Hamza
Ameer Hamza 2020-4-20
try this. X is the n*2 matrix given in your question
r=[0 10 15 20 30];
t=[10 10 15 10 10];
x = interp1(r,t, X(:,1));
mask = X(:,2) >= x;
plot(r, t, 'r', X(mask,1), X(mask,2), 'r*', X(~mask,1), X(~mask,2), 'b*')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by