I have a 60 x 21 x 700
matrix, where the 60 x 21
represent a pressure output
x number of frames
. I want to find the 2 x
A moving average can be done with a simple convolution. It has to be 2D in your case, so:
A = [01 02 02 01 01
02 01 01 02 02
02 03 04 04 03
01 02 06 10 05
02 02 08 09 05];
B = [1 1;1 1] / 4 ; %// prepare moving average filter [2x2]
C = conv2(A,B,'valid') ; %// perform 2D moving average
Produces:
C =
1.5 1.5 1.5 1.5
2 2.25 2.75 2.75
2 3.75 6 5.5
1.75 4.5 8.25 7.25
Which is exactly the average of each of your [2x2] areas.