Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Could anyone please help me to do matrix multiplication with respect to the sample data given below.
조회 수: 1 (최근 30일)
이전 댓글 표시
If
A=[2 3 4]
B=A*[1;
2;
3]
so i want to multiply 2 with
[1;
2;
3]
followed by 3 with
[1;
2;
3]
finally 4 with
[1;
2;
3]
so at the end i need to have 3x3 matrix.
댓글 수: 0
답변 (1개)
Sindar
2020년 2월 21일
Matrix multiplication only works when the "middle" dimension matches ( N x M ) * ( M x O )
Check the sizes of your matrices:
>> size(A)
ans =
1 3
>> size([1;2;3])
ans =
3 1
So, A*([1;2;3]) is not valid, but ([1;2;3])*A is (and gives you what you want):
>> B = [1;2;3]*A
B =
2 3 4
4 6 8
6 9 12
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!