Can you please explain the functional difference between the following 2 cases. I want to understand how case 1 works actually.
a is matrix of dimension 7×7 or higher.
Intended Operation: Each interior pixel is sum of its 4 non-diagonal neighbors
_________________________________________________________________
case 1
b = a;b (2:6, 2:6) = b(1:5, 2:6) + b(3:7, 2:6) + b(2:6, 1:5) + b(2:6, 3:7);
case 2
b = a;for i=2:6 for j=2:6 b (i, j) = b(i-1, j) + b(i+1, j) + b(i, j-1) + b(i, j+1); endend
Best Answer