フィルターのクリア

Hi everyone, I need your help on ouple of questions. I need to do summation on a three dimensional array.

2 ビュー (過去 30 日間)
My array has 59 rows, 77 columns and360 months. I need to get sum of 3 months for all 360 months so that I will have 59*77*120 matrix. What I did is the following;
k=matrix (:,:,1);
for j=1:length(matrix);
sumof3months(:,:,j)=sum(matrix(:,:,k:k+2));
k=k+3
end
Question two
I have 59x77x360 matrix. I need to do integration over the third dimension.
Intmatrix=integral (matrix,1,360)

採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 28 日
sumof3months = matrix(:,:,1:3:end) + matrix(:,:,2:3:end) + matrix(:,:,3:3:end);
Intmatrix = trapz(matrix, [], 3);
  3 件のコメント
Walter Roberson
Walter Roberson 2017 年 11 月 28 日
mask = sumof3months20_50 == 0;
probabilityofzero = sum(mask, 3) ./ size(mask,3);
Engdaw Chane
Engdaw Chane 2017 年 11 月 28 日
Walter, thank you very much for your kindness! Cheers!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by