Using matlab to find vectors that are orthogonal to another vector.
239 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lee Ming De
el 7 de Nov. de 2019
Editada: David Goodmanson
el 10 de Mayo de 2023
Is there a way that matlab can be used to find a general solution for vectors that are orthogonal to another vector. (eg, (1,1) )? Without using matlab, i can get the general solution which is x =-y, but i cant find a way to do this using matlab.
0 comentarios
Respuesta aceptada
Jan
el 7 de Nov. de 2019
Editada: Jan
el 7 de Nov. de 2019
Do you mean 2D vectors?
v = rand(1, 2) % Any test vector
vp = [-v(2), v(1)]
dot(v, vp) % Orthogonal means: dot product is 0
So "x=-y" is a part of the solution. Add "y=x" and you get one of the two perpendicular vectors. -vp is the other one.
2 comentarios
David Goodmanson
el 10 de Mayo de 2023
Editada: David Goodmanson
el 10 de Mayo de 2023
Hi O^2,
n = 5;
v = rand(n,1)
% make sure that v is a row vector, just in case it was a column vector
v = v(:).'
% find a set of n-1 mutually orthogonal column vectors
% that are all perpendicular to v.
n = null(v)
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Coder 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!