norm()

Read(2824) Label: matrix, vector, normalize,

Description:

Normalize a matrix or a vector.

Syntax:

norm(A)

Note:

The function normalizes a matrix or a vector by subtracting the mean from each element of every row and then dividing each element by the square root of the sum of squares.

Parameter:

A

A matrix or a vector.

Option:

@0

Enable subtracting the mean from each row only without keeping lengths same; the mean value after normalization is 0.

@s

0-1 normalization; mean value after normalization is 0, and standard deviation is 1.

Return value:

Sequence

Example:

 

A

 

1

=[2,3,5]

 

2

=norm(A1)

Normalize a vector.

3

=norm@0(A1)

Subtract the mean from each row only and mean value after normalization is 0.

4

=norm@s(A1)

0-1 normalization.

5

[[8, 1, 6], [3, 5, 7], [4, 9, 2]]

 

6

=norm(A5)


Normalize a matrix.

7

=norm@0(A5)

Subtract the mean from each row only and mean value after normalization is 0.