Borrar filtros
Borrar filtros

Find the intersection of two vectors

2 visualizaciones (últimos 30 días)
Mahsa
Mahsa el 9 de Oct. de 2013
Respondida: Walter Roberson el 10 de Oct. de 2013
I have two pairs of point and vector in 2d and I should find its intersection. for example: p0=[0,0] vector_p0=[0,1] and p1=[-10,37.3205] vector_p1=[0.5;-0.866]

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Oct. de 2013
So is that like
x0 = 0 + 0 * t
y0 = 0 + 1 * t
x1 = -10 + 0.5 * t
y1 = 37.3205 - 0.866 * t
and you want to find the t such that x0 = x1 and y0 = y1 ?
If so, then you will have two equations in one unknown, and it will not be generally possible to find the solution.
0 + 0 * t is 0, so comparing that to x1, 0 = -10 * t/2 so t = 20 (exactly). Substituting into y0, we get that y0 = 0 + 1 * 20 = 20, and bringing that across to y1, we get that 20 = 37.3205 - 0.866 * 20. That leads to the conflict 20 = 20.0005.
If we guess that 0.866 is intended to represent 13/15 then 20 = P + 13/15*20 results in the solution P = 112/3 which is 37.3333 to 4 decimal places, not 37.3205.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by