This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Compute Determinants and Traces of Square Matrices

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

MuPAD® provides the functions for performing many special operations on matrices. You can compute the dimensions of a matrix, swap or delete columns and rows, or transpose a matrix. For square matrices, you can compute determinants and traces.

To compute the determinant of a square matrix, use the det function. For example, compute the determinant of the following 2×2 matrix:

A := matrix(2, 2, [a, b, c, d]):

Now, compute the determinant of the 12×12 Hilbert matrix:


To compute a sum of the diagonal elements of a square matrix (the trace of a matrix), use the linalg::tr function. For example, the trace of the matrix A is:

A := matrix(2, 2, [a, b, c, d]):

Now, compute the trace of the 12×12 Hilbert matrix:

H := linalg::hilbert(12):

Was this topic helpful?