How can I find an orthogonal vector?

This seems like it should be simple, but I haven't been able to figure out how to use Matlab to calculate an orthogonal vector.
If my vector is:
syms a
p=[1;-a;0]
Then dot(p, the_orthogonal_vector) should = 0. But how can I calculate the orthogonal vector? I tried
help null
but couldn't see how to apply that to this.

1 Comment

The vector you gave is on the xy plane, therefore one of the orthogonal vectors is also on that plane. The formula for that is to transpose the x and y values and change the sign of one of them. For example, the vector u = [a;1;0] is orthogonal to p. v = [-a;-1;0] is also orthogonal. This is a special case where vectors on one of the primary planes, xy, xz, yz, can use the transpose and a sign change to find an orthogonal vector.

Sign in to comment.

 Accepted Answer

Hello Sue,
use null of the transpose of p:
syms a
p=[1;-a;0]
n = null(p.')
n =
[ a, 0]
[ 1, 0]
[ 0, 1]
and each column of n is perpendicular to p, as is any linear combination of those two columns.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!