MATLAB: Unit vectors
From Robotics
← Previous: Vector algebra | Web interface | MATLAB overview | Back to article: Unit vectors | Next: Simple arithmetic operations → |
Like explained in the unit vectors article, you have to divide a vector by its magnitude to obtain the corresponding unit vector. This is exactly how it has to be done in MATLAB. Therefor the norm-function presented before is used. Corresponding to the example in the article, the unit vector be is computed based on vector b as follows:
Applying the norm-function to the new vector be proves that is has length 1. The described approach works for vectors of any dimension.