← All MATLAB Flashcard Decks

Matrix and Array Operations Flashcards

7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Matrix and Array Operations flashcards as text
  1. What does `kron(A, B)` compute in MATLAB?

    Answer: The Kronecker tensor product of A and B

    `kron(A, B)` computes the Kronecker product, replacing each element of A with that scalar times the entire matrix B.

  2. Which MATLAB function computes the rank of a matrix?

    Answer: rank(A)

    `rank(A)` returns the numerical rank of A, estimated as the number of singular values above a tolerance.

  3. What is the output of `triu([1 2 3; 4 5 6; 7 8 9])`?

    Answer: [1 2 3; 0 5 6; 0 0 9]

    `triu` returns the upper triangular part of a matrix, keeping elements on and above the main diagonal.

  4. What does `repmat(A, 2, 3)` do to matrix A?

    Answer: Tiles A into a 2×3 block grid

    `repmat(A, m, n)` replicates A in an m×n tiling pattern to create a larger matrix.

  5. In MATLAB, what does `norm(v)` compute for a vector v by default?

    Answer: The L2 norm (Euclidean length)

    By default, `norm(v)` computes the 2-norm (Euclidean norm), the square root of the sum of squared elements.

  6. What does `any(A, 2)` return for a matrix A?

    Answer: A column vector: true for each row that has at least one nonzero element

    `any(A, 2)` operates along dimension 2 (columns), returning a column vector indicating rows with at least one nonzero element.

  7. Which expression correctly extracts the sub-matrix from rows 2–3 and columns 1–2 of a 4×4 matrix A?

    Answer: Both A(2:3, 1:2) and A([2,3], [1,2]) work

    Both range indexing `2:3` and index vector `[2,3]` select the same rows and columns, so both expressions are equivalent.