MATLAB: Altering matrices

homeworkmatrix manipulation

need some help for matrices …
Your program should calculate new matrices where each point consists of the average of the surrounding 8 points and itself.
x11 x12 x13
x21 x22 x23
x31 x32 x33
The new value of x22 is the average of x11…x33. For simplicity, you do not need to calculate the average for the pixels on the edge. thanks

Best Answer

convn(A,B,'same')
where A is your matrix, and B is a mask that determines the weightings of points for averaging.
doc convn
for more details