```Path: news.mathworks.com!not-for-mail
From: "je w" <jingyerushisg@yahoo.com.sg>
Newsgroups: comp.soft-sys.matlab
Subject: Linear Combination
Date: Wed, 17 Dec 2008 10:31:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <giakd7\$ri2\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229509863 28226 172.30.248.35 (17 Dec 2008 10:31:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 17 Dec 2008 10:31:03 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:507475

Anyone knows how to write a matlab code for linear combination?

Question: a=[43 50 86 93 129]. the linear combination between the elements of a can be expressed by using:
i) simple multiple of preceeding elements; e.g. a(3)=2a(1)
ii) a multiple of a difference between two preceeding elements, added to a multiple of another preceeding elements; e.g. a(4)=[a(2)-a(1)]+2a(1)

The output of linear combination of the above matrix a should be:

a(2) has no linear combination;

a(3)=2a(1);

a(4)=[a(2)-a(1)]+2a(1);

a(5)=3a(1)and a(5)= [a(3)-a(1)]+2a(1)

note there can be more than one linear combination for each element.

Thank you sooooooooo much!:-)

```