English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Assuming two matrices A and B. If A is an m x n matrix and B is an n x p matrix, they can be multiplied to get an m x p matrix C. Matrix multiplication is possible only when the number of columns n in A is equal to the number of rows n in B.
In matrix multiplication, the row elements of the first matrix are multiplied by the corresponding column elements of the second matrix.
The (i,j) element in the resulting matrix CTheThe position of each element is the first matrixThe element in the ith row of the first matrixThe second matrixThe element in the ith row of the first matrixThe sum of the products of the corresponding elements in the jth column.
Matrix multiplication in MATLAB is achieved by using*Executed by the operator.
Create a script file using the following code-
a = [ 1 2 3; 2 3 4; 1 2 5] b = [ 2 1 3 ; 5 0 -2; 2 3 -1] prod = a * b
When running the file, it displays the following result-
a = 1 2 3 2 3 4 1 2 5 b = 2 1 3 5 0 -2 2 3 -1 prod = 18 10 -4 27 14 -4 22 16 -6