Moving Average Function

버전 1.0.0.0 (5.5 KB) 작성자: Glen
Calculates a moving average in an n-dimensional matrix in any dimension.
다운로드 수: 12K
업데이트 날짜: 2013/5/22

라이선스 보기

result=movingmean(data,window,dim,option) computes a centered moving average of the data matrix "data" using a window size specified in "window" in "dim" dimension, using the algorithm specified in "option". Dim and option are optional inputs and will default to 1.

Dim and option optional inputs can be skipped altogether or can be replace with a []. For example movingmean(data,window) will give the same results as movingmean(data,window,1,1) or movingmean(data,window,[],1).

Input data matrix size and dimension is only limited by the maximum matrix size for you platform. Window must be an integer and should be odd. If window is even then it is rounded down to the next lower odd number.

Function computes the moving average incorporating a center point and (window-1)/2 elements before and after in the specified dimension. At the edges of the matrix the number of elements before or after are reduced so that the actual window size is less than the specified window.

The function is broken into two parts, a 1d-2d algorithm and a 3d+ algorithm. This was done to optimize solution speed, especially in smaller matrices (i.e. ~1000 x 1). Further, several different algorithms to the 1d-2d and 3d+ problem are provided as in certain cases the default algorithm is not the fastest. This typically happens when the matrix is very wide (i.e. 100 x 100000 or 10 x 1000 x 1000) and the moving average is being computed in the shorter dimension. The size where the default algorithm is slower will depend on the computer.

인용 양식

Glen (2024). Moving Average Function (https://www.mathworks.com/matlabcentral/fileexchange/41859-moving-average-function), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Preprocessing Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0