matrix addition and calculating the average of it
조회 수: 1 (최근 30일)
이전 댓글 표시
how to add the three matrix and get the average of it A=rand(4*4) B=rand(4*4) C=rand(4*4)
답변 (1개)
Benjamin Kraus
2017년 12월 6일
You can add three matrices using the + operator, which will do element-by-element addition:
D = A+B+C;
If you want to get the mean/average, you can divide the sum by 3:
M = D./3;
Note: In this case, you are dividing by a scalar (3), so ./ and / will do the same thing. If you were dividing by a matrix you would need to make sure to use the correct division operator.
참고 항목
카테고리
Help Center 및 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!