Difference between revisions of "MATLAB: Unit vectors"

From Robotics
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{MatlabNavigation|previous=[[MATLAB: Vector algebra|Vector algebra]]|article=[[Unit vectors]]|next=[[MATLAB: Simple arithmetic operations|Simple arithmetic operations]]}}
 
{{MatlabNavigation|previous=[[MATLAB: Vector algebra|Vector algebra]]|article=[[Unit vectors]]|next=[[MATLAB: Simple arithmetic operations|Simple arithmetic operations]]}}
 +
 +
 +
Like explained in the [[Unit vectors|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 [[Unit vectors|example]] in the article, the unit vector ''be'' is computed based on vector ''b'' as follows:
 +
 +
''Hint: For detailed information about arithmetic operations in MATLAB please have a look on the article about [[MATLAB: Simple arithmetic operations|simple arithmetic operations]]''
 +
 +
:[[File:matlab-va-unit.png|400px]]
 +
 +
Applying the ''norm''-function to the new vector ''be'' proves that is has length 1. The described approach works for vectors of any dimension.
  
 
[[Category:MATLAB]]
 
[[Category:MATLAB]]
 
[[Category:Vectors]]
 
[[Category:Vectors]]

Latest revision as of 11:10, 26 September 2014

← Previous: Vector algebra Matlab.png 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:

Hint: For detailed information about arithmetic operations in MATLAB please have a look on the article about simple arithmetic operations

Matlab-va-unit.png

Applying the norm-function to the new vector be proves that is has length 1. The described approach works for vectors of any dimension.