How to Find Minor Matrices in MATLAB
by Michael PeterTypical MATLAB science and engineering software applications include data processing and analysis where built-in matrix operations, including addition and multiplication, manipulate data. MATLAB’s plotting functions then visualize the data. Removing a row and column from a matrix and taking the determinant of the smaller matrix produces row and column minors, which calculate the matrix cofactor. MATLAB doesn't include a built-in function capable of taking the minor of a matrix, however knowing other matrix manipulation techniques makes it possible to calculate the minor with the software.
Clear all active variables within the workspace; enter clear all in the MATLAB command window.
Create a sample square matrix. Input x=rand(3,3) into the command window. This creates a 3 by 3 row/column matrix of random numbers.
Take the minor Mrc of the matrix created earlier by omitting the elements in the row, r, and column, c, of the minor and then take the determinant of the resulting matrix. To find the minor M23 input x(2,:)=[] followed by x(:,3)"=[]. The first command deletes the second row from the matrix "x." The second command deletes the third column from the matrix "x". The sample matrix has now transformed from a 3 x 3 to a 2 x 2 matrix.
Take the determinant of the modified matrix. Input det(x) in the command window to output the minor M23 of matrix "x."
Tip
- check Taking the determinant requires a square matrix; therefore the initial matrix must be square.