clear;

clc;

A = [1 3 5 2;2 4 6 5;-1 7 1 10];

[m n] = size(A);

for i = 1:n %columns

for j = i+1:m %rows (starts on second row because the first row remains unchanged.)

A(j,:) = A(j,:)-A(j,i)/A(i,i)*A(i,:);

end

end

Modify the given code to create a function that returns the inverse of a matrix when that matrix is passed in. Return an error if the matrix is not square, or if it is not full rank. The code must handle the situation where there is a zero in the pivot POSITION. You may use for loops, if statements, and the following commands: rank, and size. Make a pdf file that demonstrates that the code works when under the following test cases:

1. Matrix is square and full rank, no zeros in pivots.

2. Matrix is not square.

3. Matrix is square but not full rank.

4. Matrix is square and full rank and has a zero in a pivot and a zero immediately under the zero in the pivot.

**Subject Computer Science Programming (Dynamic, Linear, Non-linear, etc.)**