function m = minorMatrix(M,r,c)
dim = length(M);
m = zeros(dim-1);
rvec = [1:(r-1),(r+1):dim];
cvec = [1:(c-1),(c+1):dim];

for i = 1:dim-1
    for j = 1:dim-1
        m(i,j) = M(rvec(i),cvec(j));
    end
end
end

