Friday, October 23, 2009

Operations element by element, again

Hi Jackmatze, how are you? I think you are just as old as me, but it's other thing.
About your question, I made a post that answers you: it's here.

So, let me show an example:

-->matrix1 = [1 2 1;
-->2 1 2;
-->1 2 3]
matrix1 =

1. 2. 1.
2. 1. 2.
1. 2. 3.

-->matrix2 = [1 1 2;
-->0 2 1;
-->1 3 1]
matrix2 =

1. 1. 2.
0. 2. 1.
1. 3. 1.

-->matrix_t = matrix1*matrix2
matrix_t =

2. 8. 5.
4. 10. 7.
4. 14. 7.

-->matrix_dott = matrix1.*matrix2
matrix_dott =

1. 2. 2.
0. 2. 2.
1. 6. 3.


Now, what's the difference of matrix1^2 and matrix1.^2?

matrix1^2 = matrix1*matrix1

matrix1.^2 = matrix1.*matrix1


Ok, Jack? Anything more, I'll try to help you.

No comments: