MATLAB Answers

0

Using matlab to find vectors that are orthogonal to another vector.

Asked by Lee Ming De on 7 Nov 2019
Latest activity Edited by Jan
on 7 Nov 2019
Accepted Answer by Jan
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 Comments

Sign in to comment.

1 Answer

Answer by Jan
on 7 Nov 2019
Edited by Jan
on 7 Nov 2019
 Accepted Answer

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.

  0 Comments

Sign in to comment.