필터 지우기
필터 지우기

I have some point and one line.

조회 수: 2 (최근 30일)
Mili Kian
Mili Kian 2020년 4월 19일
댓글: Ameer Hamza 2020년 4월 21일
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*')
  댓글 수: 2
Mili Kian
Mili Kian 2020년 4월 21일
Thanks alot
this is the code that i want
best regard
Ameer Hamza
Ameer Hamza 2020년 4월 21일
Glad to be of help.

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

추가 답변 (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