Identify & Removing Linear Dependent row/s

13 ビュー (過去 30 日間)
Ethan Maxey
Ethan Maxey 2022 年 2 月 13 日
コメント済み: Ethan Maxey 2022 年 2 月 13 日
How can I print this matrix so that it finds and prints on the screen a column of the matrix that can be deleted so that the remaining columns still span R4?
Matrix = [10,-7,1,4,6;-8,4,-6,-10,-3;-7,11,-5,-1,-8;3,-1,10,12,12]
Matrix = 4×5
10 -7 1 4 6 -8 4 -6 -10 -3 -7 11 -5 -1 -8 3 -1 10 12 12
A=[10,-7,1,4,6;-8,4,-6,-10,-3;-7,11,-5,-1,-8;3,-1,10,12,12];
%rref(A) I'm not sure how this rref would work but I know I would need an if conditional.
I can't figure out how to remove the specific column based on if it is linearly dependent/independent.
  3 件のコメント
Image Analyst
Image Analyst 2022 年 2 月 13 日
Which column do you want to delete? Just do
Matrix(:, 4) = []; % Delete column 4.
What do you mean by "still span R4"? For this 2-D Matrix, what is R4? What is your expected output?
Ethan Maxey
Ethan Maxey 2022 年 2 月 13 日
I would like the result to print the matrix without the linearly dependent column(s). R4 is the rank. It is determined by the maximum number of linearly independent columns.
The issue is I am not allowed to hard code it by just removing column 4, it has to work with any given matrix to remove the linearly dependent column(s).

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

採用された回答

Voss
Voss 2022 年 2 月 13 日
How about this?
Matrix = [10,-7,1,4,6;-8,4,-6,-10,-3;-7,11,-5,-1,-8;3,-1,10,12,12]
Matrix = 4×5
10 -7 1 4 6 -8 4 -6 -10 -3 -7 11 -5 -1 -8 3 -1 10 12 12
[~,p] = rref(Matrix)
p = 1×4
1 2 3 5
removed_column_idx = setdiff(1:size(Matrix,2),p)
removed_column_idx = 4
removed_columns = Matrix(:,removed_column_idx)
removed_columns = 4×1
4 -10 -1 12
reduced_Matrix = Matrix(:,p)
reduced_Matrix = 4×4
10 -7 1 6 -8 4 -6 -3 -7 11 -5 -8 3 -1 10 12
  1 件のコメント
Ethan Maxey
Ethan Maxey 2022 年 2 月 13 日
Works perfectly! Thanks!

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

その他の回答 (0 件)

カテゴリ

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