MATLAB: How to do running mean meannanmean Hi all, I have a 3d matrix with a dimension of 21*41*273, for which I want to do the running mean over the third dimension (273 days) for every 4 days. Any help would be appreciated. Best Answer Try something like thisM = rand(21, 41, 273);M_new = movmean(M, [0 3], 3, 'Endpoints', 'discard');M_new = M_new(:,:,1:4:end); Related SolutionsMATLAB: How can you calculate the mean of paired figures moving down a column of a variable Try movmeanmeans = movmean(m, 2)or else trymeans = conv(m, [.5,.5], 'same'); MATLAB: Using smoothing techniques plot graph. This is a moving average filter. You can use movmean(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/movmean.html with 'EndPoints' option set to 'discard'movmean(y, 3, 'Endpoints', 'discard') % first filtermovmean(y, 5, 'Endpoints', 'discard') % Second filter Related QuestionAverage of 3d matrixAssign moving window average if 50 % of the values in the window are within a thresholdMedian vs Mean averages using skewnessBiased smoothing moving averageCompress down a 1000×1000 matrix into a 100×100 matrixHow to plot an histogram enveloppeHow do i predict future price by applying moving average
Best Answer