Complete the code to create a 2x2 matrix named A.
A = [1 [1] 2; 3 4];
The comma , separates elements in the same row of a matrix in MATLAB.
Complete the code to access the element in the first row, second column of matrix A.
element = A([1], 2);
In MATLAB, indexing starts at 1, so the first row is accessed with 1.
Fix the error in the code to multiply two matrices A and B.
C = A [1] B;The * operator performs matrix multiplication in MATLAB.
Fill both blanks to create a 3x3 identity matrix and multiply it by 5.
I = eye([1]) * [2];
eye(3) creates a 3x3 identity matrix, and multiplying by 5 scales all elements by 5.
Fill all three blanks to create a matrix M with elements from 1 to 9 arranged in 3 rows and 3 columns.
M = reshape([1], [2], [3]);
reshape(1:9, 3, 3) arranges numbers 1 to 9 into a 3x3 matrix.
