In order to construct the matrix used in class:
0 0 0
1 0 0
0 1 0
I used the tril (triangle lower) command. It will take the lower triangular part of a matrix and convert all other values to zero. The second argument is optional and specifies how many diagonals above or below the main diagonal should also be set to zero.
A=[1,2,3;4,5,6;7,8,9];
P=tril(ones(3),-1);
Q=tril(ones(30,-2);
B=P-Q;
Shiftdown=B*A
Shiftright=A*B
Matrix P:
0 0 0
1 0 0
1 1 0
Matrix Q:
0 0 0
0 0 0
1 0 0
The matrix, Shiftright, which is the result of A*B is the answer to 21.
The matrix, Shiftdown, which is the result of B*A is the answer to 22.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment