Search code examples
matlabmatrixdeterminants

how to compute all the minors with a given order of a matrix in matlab


I have a matrix m*n, I want from it all the minors (the determinant of the submatrices) of order p.

I din't found anything good in the documentation, I could do it with a function written by my self, but I'd prefer something out of the box.

My real need is to check when,in a symbolic matrix, I have a fall of rank,and that happens when all the minors of that rank and above are zeros.

Any idea to do it with pure matlab comands? since there is a function to evalutate rank it has get the minors someway.


Solution

  • There appear to be some good answers already, but here is a simple explanation of what you can do:

    Suppose you want to know the rank of every i-jth submatrix of a matrix M.

    Now i believe the simplest way to get all ranks is to loop over all rows and columns and store this result in a matrix R.

    M = magic(5);
    R = NaN(size(M));
    for i=1:size(M,1);
      for j=1:size(M,2);
        R(i,j) = rank(M([1:i-1 i+1:end],[1:j-1 j+1:end]));
      end
    end
    

    If you want all determinants replace rank with det.