Borrar filtros
Borrar filtros

I have some point and one line.

2 visualizaciones (últimos 30 días)
Mili Kian
Mili Kian el 19 de Abr. de 2020
Comentada: Ameer Hamza el 21 de Abr. de 2020
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 comentarios
David Welling
David Welling el 19 de Abr. de 2020
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 el 20 de Abr. de 2020
these points were for example. in fact i have more than a hundread points.

Iniciar sesión para comentar.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 20 de Abr. de 2020
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 comentarios
Mili Kian
Mili Kian el 21 de Abr. de 2020
Thanks alot
this is the code that i want
best regard
Ameer Hamza
Ameer Hamza el 21 de Abr. de 2020
Glad to be of help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by