As a part of a large function in my MATLAB code I have to calculate difference between elements of matrices and sum them up in a special way. Let me illustrate my case with sample matrices:
1 2 3 49 10 11 12
and
5 6 7 813 14 15 16
My calculations goes as follows:(Zeroes appear due to padding)
(1-2)(5-6)+(2-3)(6-7)+(3-4)(7-8)+(4-0)(8-0): This replaces 1 in initial matrix.(2-3)(6-7)+(3-4)(7-8)+(4-0)(8-0)+(0-0)(0-0): This replaces 2 in initial matrix.(3-4)(7-8)+(4-0)(8-0)+(0-0)(0-0)+(0-0)(0-0): This replaces 3 in initial matrix.........
Coming to second row of matrices:
(9-10)(13-14)+(10-11)(14-15)+(11-12)(15-16)+(12-0)(16-0): This replaces 9 in initial matrix.(10-11)(14-15)+(11-12)(15-16)+(12-0)(16-0)+(0-0)(0-0): This replaces 10 in initial matrix..........
As an inexperienced programmer I am finding this task really hard. Can someone please help me?
Best Answer