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.8462    0.9465    0.6874    0.8668 
    0.1218    0.9206    0.5877    0.5837 
    0.7081    0.6608    0.2035    0.5083 

--> norm(A,1)

ans = 
    2.5280 

--> norm(A,2)

ans = 
    2.2997 

--> norm(A,inf)

ans = 
    3.3470 

--> norm(A,'fro')

ans = 
    2.3712 
Next, we calculate some vector norms.
--> A = float(rand(4,1))

A = 
    0.3458 
    0.1427 
    0.3998 
    0.7194 

--> norm(A,1)

ans = 
    1.6078 

--> norm(A,2)

ans = 
    0.9041 

--> norm(A,7)

ans = 
    0.7217 

--> norm(A,inf)

ans = 
    0.7194 

--> norm(A,-inf)

ans = 
    0.1427