MATLAB: I have some point and one line.

points

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

Best Answer

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*')