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.0063    0.2224    0.7574    0.9848 
    0.7319    0.1965    0.7191    0.7010 
    0.8319    0.6392    0.8905    0.9280 

--> norm(A,1)

ans = 
    2.6138 

--> norm(A,2)

ans = 
    2.3403 

--> norm(A,inf)

ans = 
    3.2896 

--> norm(A,'fro')

ans = 
    2.4353 

Next, we calculate some vector norms.

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

A = 
    0.5011 
    0.3269 
    0.8192 
    0.7321 

--> norm(A,1)

ans = 
    2.3792 

--> norm(A,2)

ans = 
    1.2510 

--> norm(A,7)

ans = 
    0.8671 

--> norm(A,inf)

ans = 
    0.8192 

--> norm(A,-inf)

ans = 
    0.3269