vector matrix multiplication with increment

4 ビュー (過去 30 日間)
PK
PK 2012 年 9 月 28 日
for a constant incremental of +1 the out result is to be multiplied and stored in another matrix ex: A=[1 2 3 4 5] and W=4 so the result is to be as OUT=[1*W 2*(W+1) 3*(W+3) 4*(W+4) 5*(W+5)] addition to occur first and then multiplication can u help in this.
  1 件のコメント
José-Luis
José-Luis 2012 年 9 月 28 日
Is this homework?

サインインしてコメントする。

回答 (2 件)

Sabarinathan Vadivelu
Sabarinathan Vadivelu 2012 年 9 月 28 日
W = 4;
A = [1 2 3 4 5];
n = numel(A);
for i = 1 : n
out(i) = [A(i)*(W+i)];
end

Andrei Bobrov
Andrei Bobrov 2012 年 9 月 28 日
out = A.*(W + A)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by