Form a Cumulative sum matrix
古いコメントを表示
S= 10x1300
R=10x1300
z1= S1+R1 x1300
z2=S1+R1+R1+S2+R2 x1300
z3=S1+R1+R1+S2+R2+R2+S3+R3 x1300
.
.
.
z10=S1+R1+R1+S2+R2+R2+S3+R3+.. +R9+S10+R10+R10 x 1300
Result: Form z, a 10x1300 matrix
S & R is a 10x1300 matrix of random numbers
First row of matrix z= First row of S + first row of R
Second row of matrix z= First row of S + first row of R + first row of R + second row of S + second row of R + second row of R
Each addition adds Previous row of R and the next row of S and R
採用された回答
その他の回答 (2 件)
Andrei Bobrov
2017 年 11 月 15 日
編集済み: Andrei Bobrov
2017 年 11 月 15 日
z = cumsum(S + 2*R) - [R(1:end-1,:); zeros(1,size(R,2))];
ali fadaie
2017 年 11 月 24 日
0 投票
Yes it is right
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!