Testing for Linear Dependence (Matrix Errors when running)
Afficher commentaires plus anciens
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?
Réponses (1)
Wayne King
le 28 Déc 2013
Modifié(e) : Wayne King
le 28 Déc 2013
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
Catégories
En savoir plus sur Operating on Diagonal Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!