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]; % This is can be used for weight factor of moving average
Calculate two dimensional moving averaged matrix of A
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)
As a result,
ans =
1.5000 2.2500 2.7500 3.5000
2.0000 2.5000 2.5000 3.0000
1.7500 2.7500 3.5000 3.2500
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers48
Suggested Problems
-
Sum of diagonal of a square matrix
1645 Solvers
-
Make a random, non-repeating vector.
11776 Solvers
-
Getting the indices from a vector
12404 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
896 Solvers
-
Given a matrix, return the last eigen value
233 Solvers
More from this Author27
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!