MATLAB Answers

linearly independent or linearly dependent.

4 views (last 30 days)
mohammed alnatsheh
mohammed alnatsheh on 7 May 2021
Commented: Jonas on 9 May 2021
how can i determine if vector v is a linear combination of the members of the S by using matlab ?
S = {(1,2,-1),(2,-1,0),(-1,8,-3)}
v = (0,5,-2)

Answers (2)

Matt J
Matt J on 9 May 2021
Edited: Matt J on 9 May 2021
If [S,v] and S have the same rank, then the column vector v must be a linear combination of the columns of the matrix S.Testing this in your example,
S = [1,2,-1 ; 2,-1,0 ; -1,8,-3].' ;
v = [0,5,-2].';
isDependent = rank([S,v])==rank(S)
isDependent = logical
1
  1 Comment
Jonas
Jonas on 9 May 2021
i like that solution, nice and clean!

Sign in to comment.


Jonas
Jonas on 8 May 2021
Edited: Jonas on 8 May 2021
you could use something like
syms a b c; [sola,solb,solc]=solve(S{1}*a+S{2}*b+S{3}*c==v,a,b,c)

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!