How to get a sum of a series

2 ビュー (過去 30 日間)
dav
dav 2014 年 2 月 20 日
Hello,
I need to get the sum of
Y(t)= A(i)*X(t-i)
where X is a vector of size (100,1). A is a vector of size (3,1)
i=0 to 2 and t= 3 to 100.
Any help is greatly appreciated.
Thanks
Dav

採用された回答

kjetil87
kjetil87 2014 年 2 月 20 日
t = 3:100;
sumY=0;
for i=0:2
sumY = sumY+sum(A(1+i)*X(t-i)) ;
end
like this?

その他の回答 (2 件)

Muruganandham Subramanian
Muruganandham Subramanian 2014 年 2 月 20 日
Try using 'cumsum' command

David Young
David Young 2014 年 2 月 20 日
編集済み: David Young 2014 年 2 月 20 日
If you want the sum over i for each t, then it's
Y = conv(X, A, 'valid');

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by