# I need to write down a function 'linzav' which needs to check is the given set of vectors linearly dependent or independent. If it is dependent, write down one vector as linear combination of others?

11 views (last 30 days)
David Mat on 7 Jun 2017
Commented: Stephen23 on 7 Jun 2017
##### 2 CommentsShowHide 1 older comment
Stephen23 on 7 Jun 2017
@David Mat: there are thousands of explanations and tutorials online describing how to determine if vectors are linearly independent. This forum has threads on this topic. You will learn more when you do a bit of research: like any coding task, the first step is to understand the task first (implementing the code is just an afterthought, really).

H ZETT M on 7 Jun 2017
A way to start might be something like this:
Vec_1=[1;2;3]
Vec_2=[2;4;6]
Lin=Vec_1./Vec_2
if all(Lin == Lin(1))
disp('linear')
end
So what this code actually does: You first create two vectors (which are of course linear dependent). If you devide one by the other, all elements should be the same if they are linear dependent. The "if" checks if all elements of the linear-resolution are the same. Sorry for my bad english. I hope this helps you to start with the program.