Opening the book…
Matrices can be added or subtracted only if they have the same dimensions. MATLAB performs addition and subtraction element by element.
Adding and subtracting two matrices.
Solution
C =
8 6 5
12 10 14
D =
-2 -2 -1
0 -2 2
If the dimensions of the two matrices do not match, MATLAB will return an error.
When the dimensions do not match.
Solution
error: operator +: nonconformant arguments (op1 is 2x3, op2 is 2x2) error: operator -: nonconformant arguments (op1 is 2x3, op2 is 2x2)
This page titled 13.11: Matrix Addition and Subtraction was last modified on Tue, 30 Jun 2026 02:11:59 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.