필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

cumsum but withe the twelfth observation

조회 수: 2 (최근 30일)
Zak
Zak 2013년 5월 30일
마감: MATLAB Answer Bot 2021년 8월 20일
I am using monthly data in twelfth difference (annuel variation) and for the final results I want to come back the level. I know that for the first différence we can use the cumsum function: cumsum(X(i,:,:),2)
How can I do the same think to cumulate the twelfth difference. Thanks
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 30일
Can you explain with an example?
Zak
Zak 2013년 6월 11일
I wrote this code which works well with matrix, but not in the general case. I mean when the input is an array it doesn't work. "cumsum" function works even when the input is an array
[line col] = size(x); result = zeros(line,col);
for j=13:col; for i=1:line; result(i,1:12) = x(i,1:12); result(i,j) = result(i,j-12) + x(i,j); end; end;

답변 (1개)

Julius
Julius 2013년 6월 10일
Just do cumsum repeatedly for 12 times.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by