MATLAB Answers

How can I find an orthogonal vector?

232 views (last 30 days)
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.

Accepted Answer

David Goodmanson
David Goodmanson on 2 May 2021
Edited: David Goodmanson on 2 May 2021
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)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by