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]): det(A)
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 := matrix(2, 2, [a, b, c, d]): linalg::tr(A)
Now, compute the trace of the 12×12 Hilbert matrix:
H := linalg::hilbert(12): linalg::tr(H)