Square Root of the Sum of Square for each row

v = norm2(X) % Matlab & Octave
v <- norm2(X) #R

Returns the row-wise 2-norm of matrix X, i.e., the square-root of the sum of the squares for each row. If X is a vector, norm2() is equivalent to the built-in function norm(). But if X is a matrix e.g., a triaxial accelerometer or magnetometer matrix, norm() gives the overall norm of the matrix whereas norm2() gives the vector norm of each row (i.e., the field strength in the case of a magnetometer matrix.

Input var Description Default value
X is a vector or matrix. N/A
Output var Description Units
v is the row-wise vector norm of X if X is a matrix. If X is a vector (row or column), v is the vector norm. N/A

Matlab & Octave

v = norm2([0.2 0.4 -0.7;-0.3 1.1 0.1])


sampleMatrix = matrix(c(0.2, 0.4, -0.7,-0.3, 1.1, 0.1), byrow = TRUE, nrow = 2, ncol = 3)
v <- norm2(X=sampleMatrix)  
v = c(0.83066, 1.14455)

bugs@animaltags.org Last modified: 10 May 2017

  • tagwiki/tools/processing/tagtools/processing/norm2.txt
  • Last modified: 2017/07/27 18:30
  • by das39