Testing for Linear Dependence (Matrix Errors when running)

조회 수: 12 (최근 30일)
Project Science
Project Science 2013년 12월 28일
편집: Wayne King 2013년 12월 28일
Hi,
What I'm trying to do should be straight forward, I think. First, I have 2 vectors, and I'm testing for linear dependence by A*x = b.
r = [2 1]
s = [3 2]
In MATLAB, I did:
A = [2 3; 1 2]
b = [0; 0]
inv(A) * b
Results shows that x = [0; 0], which is the correct answer.
However, when trying to add a 3rd vector, 't' to the set, things do not seem to work:
r = [2 1]
s = [3 2]
t = [1 2]
So that now;
A = [2 3 1; 1 2 2]
but when I try,
inv(A) * b
I get this error: "??? Error using ==> inv Matrix must be square."
So then I tried this to test it out:
A = [2 3 0; 1 2 0]
and I get this error: ??? Error using ==> mtimes Inner matrix dimensions must agree.
I am not sure what I am doing wrong. Any ideas how to fix this?

답변 (1개)

Wayne King
Wayne King 2013년 12월 28일
편집: Wayne King 2013년 12월 28일
A rectangular matrix cannot have a true inverse.
How about just
A = [2 3 0; 1 2 0];
rref(A)
To get the reduced row echelon form?
From the above you can see that the 3rd column, A(:,3), is -4 times the 1st column plus 3 times the second column
-4*A(:,1)+3*A(:,2)
Of course 3 vectors in R^2 which is what you have in A cannot be a linearly independent set.
Also, just
rank(A)
will tell you the dimension of the range of the columns of A. In this case, rank(A)=2

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by