Take a vector and convert it to a unit vector (normalize)
by James West
31 Aug 2010
(Updated 31 Aug 2010)
normalize a vector to a unit vector
|
Watch this File
|
| File Information |
| Description |
This function will take a [1xn] or [mx1] vector and normalize it to a unit vector length.
To use this function [vectorOut] = fcn_createUnitVector(vectorIn)
Error checking is performed to test for NaN values in the output, and a square root of the sum of the squares == 1
This function will take column or row vectors and output in said format. |
| Acknowledgements |
This file inspired
Normalize N D Vectors In Single Matrix Or N Component Matrices.
|
| MATLAB release |
MATLAB 7.9 (R2009b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 31 Aug 2010 |
Changed the code to operate in n dimensions.
It will now transform your vector back to its original notation
Error checking is now done to detect irregular calculations, and NaN values in the output
Changed the name to be more accessible. |
| 31 Aug 2010 |
Added error checking
Added output format equal to input format
Added ability to handle multi-dimensional arrays. |
|
Contact us