I am trying to find the column space of a matrix

12 ビュー (過去 30 日間)
Taylor
Taylor 2023 年 7 月 13 日
コメント済み: Carter 2024 年 11 月 7 日
I am working on a lab for my class and am having issues finding the column soace for the matrix.
A = [1,1,0,2,0;0,1,1,3,0;2,0,0,0,1;3,1,0,2,1;2,1,1,3,0;1,0,0,2,1]
A = 6×5
1 1 0 2 0 0 1 1 3 0 2 0 0 0 1 3 1 0 2 1 2 1 1 3 0 1 0 0 2 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
This is the matrix that I am using. Tried the code
rrefA = rref(A)
rrefA = 6×5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
pivotColumns = rrefA(:,1:end-1)
pivotColumns = 6×4
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
basisColumnSpace = A(:,pivotColumns)
Index in position 2 is invalid. Array indices must be positive integers or logical values.
but i cant get it to work I keep getting a error that i cant clear. I am wondering if there is another way to find the column space with the basic MatLab package. I would apperciate any help.
Thank You

回答 (1 件)

ProblemSolver
ProblemSolver 2023 年 7 月 13 日
@Taylor -- You just need to use this:
pivotColumns = find(any(rrefA, 1));
I hope this works!
  4 件のコメント
Walter Roberson
Walter Roberson 2024 年 11 月 7 日
I believe that @Torsten is providing a counter-example to illustrate the failure of @ProblemSolver approach. I do not believe that Torsten is attempting to illustrate a correct general method.
Carter
Carter 2024 年 11 月 7 日
That would make sense, thank you for the clarification.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by