Example: Matrix Norm and Determinant Functions
1. Define a square matrix.
2. Set the matrix elements to generic variable names.
3. Use the
norm1 function to find the
L1 norm of matrix
M.
Alternatively, find the L1 norm by calculating the maximum of the absolute column sums of M.
4. Use the
norm2 function to find the
L2 norm of matrix
M.
Alternatively, use the svds function to find the largest absolute singular value of matrix M.
The svds function returns a vector of sorted singular values, so the top value is the largest singular value of matrix M.
5. Use the
norme function to find the Euclidean norm of matrix
M.
Alternatively, manually calculate the square root of the sum of the absolute squares of matrix M.
6. Use the
normi function to find the Infinity norm of matrix
M.
Alternatively, use the max function to manually calculate the maximum of the absolute row sums of matrix M.
7. Use the
det function to find the determinant of matrix
M.
Alternatively, manually calculate the determinant of matrix M.
8. Use the
norm function to find the norm of a vector containing the elements of column 0 of matrix
M.
Alternatively, manually calculate the norm of vector v.