3
$\begingroup$

Lets say the non-square matrix is $n \times r$ where $n > r$ (# of rows is greater than # of columns). I'd like to find all $r \times r$ submatrices. What is really required is that I have to find and have all square submatrices simultaneously in order to compare their determinants at the same time. Here is the $6 \times 4$ matrix that I have. I need to find all fifteen $4 \times 4$ submatrices.

\begin{array}{cccc} 0 & -\text{Sin}\left[\theta _C\right] l_G & -\text{Sin}\left[\theta _D\right] l_C & 0 \\ 0 & \text{Cos}\left[\theta _C\right] l_G & \text{Cos}\left[\theta _D\right] l_C & 0 \\ -\text{Sin}\left[\theta _B\right] l_C & 0 & \text{Sin}\left[\theta _D\right] l_C & 0 \\ \text{Cos}\left[\theta _B\right] l_C & 0 & -\text{Cos}\left[\theta _D\right] l_C & 0 \\ 0 & \text{Sin}\left[\theta _C\right] l_G & \text{Sin}\left[\theta _D\right] l_C & -\text{Sin}\left[\theta _F\right] l_G \\ 0 & -\text{Cos}\left[\theta _C\right] l_G & -\text{Cos}\left[\theta _D\right] l_C & \text{Cos}\left[\theta _F\right] l_G \\ \end{array}

$\endgroup$
1
  • 1
    $\begingroup$ Please include a Mathematica-formatted version of your matrix. You are less likely to get an answer if the answerer needs to re-type everything $\endgroup$ Aug 14, 2016 at 23:46

1 Answer 1

5
$\begingroup$
Subsets[mat, {4}]

Replace mat with your matrix.

Or, more generally:

subMatrices[mat_List] := Subsets[mat, Dimensions[mat][[{2}]]]
$\endgroup$
1
  • $\begingroup$ Thanks your answer, but it does not work in a MatrixForm. It is just working when I Flatten the matrix, but it turns the matrix into an array of 48 elements! $\endgroup$
    – Ham64
    Aug 24, 2016 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.