필터 지우기
필터 지우기

Trying to do a summation of matrices

조회 수: 1 (최근 30일)
Omar
Omar 2014년 2월 3일
답변: Walter Roberson 2014년 2월 3일
I have 2 , 1x20 Matrices. Say,Matrix A and B are my 2 Matrices. What I would like to do is Sum of (A_i + A_i+1)*(B_i + B_i+1). Where A_i @ i=0 is the first term of matrix A and A_i+1 the term after that for all 20 terms. Same for B. How could I do that?

채택된 답변

Walter Roberson
Walter Roberson 2014년 2월 3일
sum((A(1:end-1) + A(2:end)) .* (B(1:end-1) + B(2:end)))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by