NORM Norm Calculation

Section: Array Generation and Manipulations

Usage

Calculates the norm of a matrix. There are two ways to use the norm function. The general syntax is
   y = norm(A,p)

where A is the matrix to analyze, and p is the type norm to compute. The following choices of p are supported

For a vector, the regular norm calculations are performed:

Examples

Here are the various norms calculated for a sample matrix
--> A = float(rand(3,4))

A = 

    0.4266    0.0755    0.8713    0.4876 
    0.8799    0.1549    0.3731    0.4750 
    0.0417    0.1658    0.5522    0.5067 

--> norm(A,1)

ans = 

    1.7967 

--> norm(A,2)

ans = 

    1.5921 

--> norm(A,inf)

ans = 

    1.8830 

--> norm(A,'fro')

ans = 

    1.7143 


Next, we calculate some vector norms.

--> A = float(rand(4,1))

A = 

    0.6840 
    0.2036 
    0.9099 
    0.6971 

--> norm(A,1)

ans = 

    2.4946 

--> norm(A,2)

ans = 

    1.3503 

--> norm(A,7)

ans = 

    0.9437 

--> norm(A,inf)

ans = 

    0.9099 

--> norm(A,-inf)

ans = 

    0.2036