What is the equivalent of mmult of excel in matlab?
조회 수: 10 (최근 30일)
이전 댓글 표시
I need to multiply two uneven matrix (1 row, 4 column and 10 row, 4 column) to yield a single value. In excel i used mmult for the same
댓글 수: 0
채택된 답변
Steven Lord
2021년 9월 10일
The * operator performs matrix multiplication, but in order for that operation to be mathematically defined you need to transpose the second matrix (so the number of columns in the first matches the number of rows in the second) and you will receive a 1-by-10 matrix not a single value.
x = [1 2 3 4]
y = reshape(1:40, 10, 4)
z = x*y.' % transpose y
To check:
z6 = 1*6 + 2*16 + 3*26 + 4*36
z(6)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!