MATLAB: Create a moving average moving average Hi There, How can I calculate a moving average for a column of data. For instance i want to average the 50 points either side of each data point in my column. Thanks Best Answer A - your dataL = filter(ones(101,1)/101,1,[A(:) zeros(50,1)]);out = L(51:end); Related SolutionsMATLAB: Matrices with customized sums for rows and columns Try randfixedsum: http://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum MATLAB: Function for Calculating Moving sum For a "moving" sum - the sum in a window - you can use conv(), or conv2() in two dimensions:windowWidth = 15; % or whatever.movingSum = conv(oneDsignal, ones(1, windowWidth));for the moving average:windowWidth = 15; % or whatever.movingAverage = conv(oneDsignal, ones(1, windowWidth) / windowWidth); Related QuestionHow to calculate moving average in a matrixMoving average of array2D moving sum of a matrix
Best Answer