# norm

## Purpose

Vector and matrix norms.

## Synopsis

    n = norm(X)
    n = norm(X,p)
    n = norm(X,'fro')

## Description

The norm of a matrix is a scalar that gives some measure of the magnitude of the elements of the matrix. Several different types of norms can be calculated:

`n = norm(X)`, where `X` is a matrix, is the largest singular value of `X`.

`n = norm(X,p)`, lets you specify a value to indicate largest singular value, largest column sum, or largest row sum of matrix `X`:

- `norm(X,1)` is the 1-norm, or largest column sum of `X`, `max(sum(abs((X)))`.
- `norm(X,2)` is the same as `norm(X)`.
- `norm(X,inf)` is the infinity norm, or largest row sum of `X`, `max(sum(abs(X')))`.
  `n = norm(X,'fro')` is the F-norm of matrix `X`, `sqrt(sum(diag(X'`*`X)))`.

  When the `X` is a vector, slightly different rules apply:

- `norm(x,p) = sum(abs(x).^p)^(1/p)`.
- `norm(x) = norm(x,2)`.
- `norm(x)/sqrt(n)` is the root-mean-square (RMS) value.
- `norm(x,inf) = max(abs(x))`.
- `norm(x, -inf) = min(abs(x))`.

  ## Examples

  For a matrix

      A =
          1    2    3
          4    5    6
          7    8    9

      norm(A)       = 16.8481
      norm(A,1)     = 18
      norm(A,2)     = 16.8481
      norm(A,inf)   = 24
      norm(A,'fro') = 16.8819

  For a vector

      v =
          1    2    3

      norm(v)       = 3.7417
      norm(v,1)     = 6
      norm(v,2)     = 3.7417
      norm(v,Inf)   = 3
      norm(v,pi)    = 3.2704

  ## See Also

      cond, max, min, rcond, svd

  (c) Copyright 1994 by The MathWorks, Inc.