Cody

# Problem 43281. Two dimensional moving average

Solution 3064819

Submitted on 5 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
A=[1 2 3 4 5 1 2 2 2 3 2 3 3 3 4 1 1 4 4 2]; B=[1 1;1 1]; y_correct = [ 1.5000 2.2500 2.7500 3.5000 2.0000 2.5000 2.5000 3.0000 1.7500 2.7500 3.5000 3.2500] assert(isequal(smooth2dconv(A,B),y_correct))

y_correct = 1.5000 2.2500 2.7500 3.5000 2.0000 2.5000 2.5000 3.0000 1.7500 2.7500 3.5000 3.2500 y = 6 y = 6 9 y = 6 9 11 y = 6 9 11 14 y = 6 9 11 14 8 0 0 0 y = 6 9 11 14 8 10 0 0 y = 6 9 11 14 8 10 10 0 y = 6 9 11 14 8 10 10 12 y = 6 9 11 14 8 10 10 12 7 0 0 0 y = 6 9 11 14 8 10 10 12 7 11 0 0 y = 6 9 11 14 8 10 10 12 7 11 14 0 y = 6 9 11 14 8 10 10 12 7 11 14 13

Index in position 1 exceeds array bounds (must not exceed 4). Error in smooth2dconv (line 4) y(i,j)=A(i,j)*B(1,1)+A(i+1,j)*B(2,1)+A(i,j+1)*B(1,2)+A(i+1,j+1)*B(2,2) Error in Test1 (line 9) assert(isequal(smooth2dconv(A,B),y_correct))

2   Fail
A=[1 1 3 4 1 2 1 2 2 3 3 1 1 1 4 4]; B=[1 2;2 1]; y_correct = [ 1.7500 3.0000 3.7500 3.0000 3.2500 3.0000 2.7500 3.7500 4.2500] assert(isequal(smooth2dconv(A,B),y_correct))

y_correct = 1.7500 3.0000 3.7500 3.0000 3.2500 3.0000 2.7500 3.7500 4.2500 y = 7 y = 7 12 y = 7 12 15

Index in position 2 exceeds array bounds (must not exceed 4). Error in smooth2dconv (line 4) y(i,j)=A(i,j)*B(1,1)+A(i+1,j)*B(2,1)+A(i,j+1)*B(1,2)+A(i+1,j+1)*B(2,2) Error in Test2 (line 9) assert(isequal(smooth2dconv(A,B),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!