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

3 Ansichten (letzte 30 Tage)
Sandy
Sandy am 27 Feb. 2023
Beantwortet: Pratheek am 1 Mär. 2023
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 Kommentare
the cyclist
the cyclist am 27 Feb. 2023
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 am 27 Feb. 2023
Output = Matrix_3_by_3 * reshape(Vector2355, 3, []);
maybe ??? The output would be 3 x 785

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Pratheek
Pratheek am 1 Mär. 2023
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).

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by