MATLAB norm

The norm function calculates a norm.


Usage

Vectors

When operating on vectors, the norm function calculates a p-norm.

To calculate a 2-norm, try:

norm([1 -2 3], 2)

As this suggests, the second argument is p. If the second argument is not specified, 2 is assumed.

Matrices

When operating on matrices, the norm function dispatches between different norm calculations based on the second argument.

To calculate the Frobenius norm, try:

norm([1 2; 3 4], "fro")

Other valid values for the second argument are...


CategoryRicottone

MATLAB/Norm (last edited 2026-02-07 04:24:56 by DominicRicottone)