Here are the key points about scalar-matrix addition in MATLAB:
- a is a scalar (single value)
- b is a matrix (2D array)
- To add a scalar to a matrix, MATLAB adds the scalar to each element of the matrix
- c = b + a performs element-wise addition, adding the value of a (which is 3) to each element of b
- The result c is the matrix b with 3 added to each element
So c would be:
c =
4 5 6
7 8 9
Scalar-matrix operations in MATLAB perform the operation on each element of the matrix.