Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A=[1 2 3; 2 2 2; -1 2 1];
- B=[1 0 0; 1 1 0; 1 1 1];
- C=[1 1; 2 1; 1 2];
- % Part (a)
- A+B
- A*B
- A+C %error because dimensions of A and C do not match
- B*A
- B-A
- A*C
- C-B %error because of dimension of C and B do not match
- C*A %error because C and A are incompatible for matrix multiplication
- %Part (b)
- %{
- The difference between A*B and A.*B is that A*B is the usual
- matrix multiplication and on the other hand, A.*B is element
- wise matrix multiplication.
- It is possible to compute A*B if number of columns of A = number of rows of B.
- On the other hand, it is possible to compute A.*B if the dimensions of A and B are the same.
- %}
- A.*B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement