Introduction to MATLAB & SIMULINK: A Project Approach, Third Edition

The following tables summarize the application of arithmetic operations in MATLAB as matrix and field operations.
Here, we shall use the matrices
and the vectors
as examples of matrices and vectors.
The first table summarizes the arithmetic operations of MATLAB as matrix operations.
| Operation in MATLAB | Effect | Example |
|---|---|---|
| A+B | matrix addition |
|
| A-B | matrix subtraction |
|
| a+b | vector addition |
|
| A*B | matrix multiplication |
|
| a*b (error!) | undefined! | |
| -3*B | scalar multiplication |
|
| A\B | left division |
|
| A/B | right division |
|
| Operation in MATLAB | Effect | Example |
|---|---|---|
| A 2 | raising to a power (exponentiation) |
|
| 2 A (error!) | undefined! | |
| a 2 (error!) | undefined! |
The following table shows the contrasting arithmetic operations of MATLAB as field operations.
| Operation in MATLAB | Effect | Example |
|---|---|---|
| A.+B (error!) | meaningless, since A + B is already term-by-term | |
| A.-B (error!) | meaningless, since A - B is already term-by-term | |
| a.+b (error!) | meaningless, since | |
| A.*B | term-by-term product |
|
| a.*b | term-by-term product |
|
| -3.*B (OK!) | scalar multiplication | see Table A.1 |
| A.\B | term-by-term division |
|
| A./B | term-by-term division |
|
| A. 2 | term-by-term exponentiation |
|
| 2 A | 2 raised to powers given by matrix terms |
|
| a. 2 | term-by-term exponentiation |
|