Recall & Review
beginner
What is matrix concatenation in MATLAB?
Matrix concatenation is the process of joining two or more matrices together either horizontally (side by side) or vertically (one on top of another) to form a larger matrix.
Click to reveal answer
beginner
How do you concatenate two matrices horizontally in MATLAB?
Use square brackets with a space or comma between matrices, like [A B] or [A, B]. This joins matrices side by side, increasing the number of columns.
Click to reveal answer
beginner
How do you concatenate two matrices vertically in MATLAB?
Use square brackets with a semicolon between matrices, like [A; B]. This stacks matrices one on top of the other, increasing the number of rows.
Click to reveal answer
intermediate
What must be true about matrices to concatenate them horizontally?
They must have the same number of rows. Otherwise, MATLAB will give an error because the rows don't match.
Click to reveal answer
intermediate
What must be true about matrices to concatenate them vertically?
They must have the same number of columns. If columns differ, MATLAB will show an error.
Click to reveal answer
Which MATLAB syntax concatenates matrices A and B horizontally?
✗ Incorrect
Using [A B] joins matrices side by side (horizontally).
What happens if you try to concatenate matrices vertically with different numbers of columns?
✗ Incorrect
MATLAB requires the same number of columns to concatenate vertically; otherwise, it throws an error.
Which symbol separates matrices when concatenating vertically in MATLAB?
✗ Incorrect
A semicolon (;) stacks matrices vertically.
If A is 3x2 and B is 3x4, what is the size of [A B]?
✗ Incorrect
Horizontal concatenation adds columns: 2 + 4 = 6 columns, rows stay 3.
If A is 2x3 and B is 4x3, what is the size of [A; B]?
✗ Incorrect
Vertical concatenation adds rows: 2 + 4 = 6 rows, columns stay 3.
Explain how to concatenate two matrices horizontally and what condition must be met.
Think about joining side by side and matching rows.
You got /2 concepts.
Describe vertical concatenation of matrices and the requirement for it to work.
Think about stacking one matrix on top of another.
You got /2 concepts.