How to fsum on only one variable?

Fred

Fred (view profile)

さんによって質問されました 2013 年 7 月 8 日
Fred

Fred (view profile)

さんの 回答が採用されました
Hi, I want to find the following Z(i)s but inside the sum is only for j. How can I write following script with sum on only j? Sorry if my question is very basic stuff
for i=1:n
for j=1:m
Z(i)=Z(i)-sum(S(j).*Z(i-j))
end
end

0 件のコメント

サインイン to comment.

2 件の回答

Fred (view profile)

2013 年 7 月 9 日
採用された回答

H=filter([1,-S],0 , Z);

0 件のコメント

サインイン to comment.

Image Analyst (view profile)

2013 年 7 月 8 日

I have no idea what you're trying to do. First of all, Z(1) will depend on Z(1) which hasn't been defined yet so that will bomb. Next, i-j will equal zero when both i and j are 1, so that will bomb also. Beyond that I have no idea whatsoever what you're trying to do. And what is S?

Fred

Fred (view profile)

2013 年 7 月 8 日
Sorry for confusion; I have two vectors Z and S (Z is my data and S are coefficients from another formula) and I want to adjust Z values by some type of differencing. So old Z values are replaced by new ones (I used the same name as Z but I can use a new name too like Z2). about i-j I think that I should think of a condition It is some think like this:
Z(i)=Z(i)-0.3*Z(i-1)-0.105*Z(i-2)-0.059*Z(i-3)-...
or
Z2(i)=Z(i)-0.3*Z(i-1)-0.105*Z(i-2)-0.059*Z(i-3)-...
where S=[0.3 0.105 0.059 ...]

サインイン to comment.

Translated by