English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
When you add, subtract, multiply, or divide a matrix by a number, this is calledscalar operation(Scalar operations).
Scalar operations produce a new matrix with the same number of rows and columns as the original matrix, with each element in the original matrix added, subtracted, multiplied, or divided by this number.
Create a script file using the following code-
a = [ 10 12 23 ; 14 8 6; 27 8 9]; b = 2; c = a + b d = a - b e = a * b f = a / bWhen the file is run, it displays the following result-
c = 12 14 25 16 10 8 29 10 11 d = 8 10 21 12 6 4 25 6 7 e = 20 24 46 28 16 12 54 16 18 f = 5.0000 6.0000 11.5000 7.0000 4.0000 3.0000 13.5000 4.0000 4.5000