Matrix and array operations
MATLAB allows you to use a single arithmetic operator or function to manipulate all values ââin a matrix
a + 10
MATLAB will execute the above statement and return the following results:
ans = 3Ã3
11 13 15
12 14 16
17 18 20
sin(a)
MATLAB will execute the above statement and return the following results:
ans = 3Ã3
0.8415 0.1411 -0.9589
0.9093 -0.7568 -0.2794
0.6570 0.9894 -0.5440
To transpose a matrix, use single quotes ('
)
a'
ans = 3Ã3
1 2 7
3 4 8
5 6 10
Perform standard matrix multiplication using the *
operator, which computes the inner product between rows and columns
p = a*inv(a)
p = 3Ã3
1.0000 0 0
0 1.0000 0
0 0 1.0000
Comments