How to multiple a 3x3 double matrices time 2355x1 double matrices

조회 수: 3 (최근 30일)
Sandy
Sandy 2023년 2월 27일
답변: Pratheek 2023년 3월 1일
I'm trying to multiply a 3x3 double matrices time 2355x1 double matrices and when I tried to run the code I get this message( Arrays have incompatible sizes for this operation).
how do I multiply them
  댓글 수: 2
the cyclist
the cyclist 2023년 2월 27일
What do you expect to happen? A 3x3 matrix and a 2355x1 vector don't have compatible sizes for either matrix multiplication or element-wise multiplication.
Let's take a smaller example. Suppose you have a 3x3 matrix and a 4x1 vector:
M = magic(3)
M = 3×3
8 1 6 3 5 7 4 9 2
V = [2; 3; 5; 7]
V = 4×1
2 3 5 7
What output do you expect from these?
Walter Roberson
Walter Roberson 2023년 2월 27일
Output = Matrix_3_by_3 * reshape(Vector2355, 3, []);
maybe ??? The output would be 3 x 785

댓글을 달려면 로그인하십시오.

답변 (1개)

Pratheek
Pratheek 2023년 3월 1일
To multiply any two matrices the basic condition that needed to be satisfied is, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix will have the same number of rows as the first matrix and the same number of columns as the second matrix.
Suppose we have two matrices A and B, with dimensions 2x2 and 2x3, respectively:
A = [2 3; 4 5]
B = [1 2 3; 4 5 6]
then the resulting matrix will be of 2x3.
C= AxB = [14 19 24; 24 33 42]
So, to answer your question, its mathematically not possible to multiply those two matrices(3x3 with a 2355x1).

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by