RUNMEAN

버전 1.0.0.0 (3.35 KB) 작성자: Jos (10584)
Version 3.0 (sep 2006) Very fast running mean (aka moving average) filter
다운로드 수: 8.2K
업데이트 날짜: 2006/9/20

라이선스 보기

For vectors, Y = RUNMEAN(X,M) computes a running mean (also known as moving average) on the elements of the vector X. It uses a window of 2*M+1 datapoints. M an positive integer defining (half) the size of the window. In pseudo code:
Y(i) = sum(X(j)) / (2*M+1), for j = (i-M):(i+M), and i=1:length(X)

For matrices, Y = RUNMEAN(X,M) or RUNMEAN(X,M,[]) operates on the first non-singleton dimension of X. RUNMEAN(X,M,DIM) computes the running mean along the dimension DIM.

If the total window size (2*M+1) is larger than the size in dimension DIM, the overall average along dimension DIM is computed.

As always with filtering, the values of Y can be inaccurate at the edges. RUNMEAN(..., MODESTR) determines how the edges are treated. MODESTR can be one of the following strings:
'edge' : X is padded with first and last values along dimension DIM (default)
'zero' : X is padded with zeros
'mean' : X is padded with the mean along dimension DIM

X should not contains NaNs, yielding an all NaN result. NaNs can be replaced by using, e.g., "inpaint_nans" created by John D'Errico.

This is an incredibly fast implementation of a running mean, since execution time does not depend on the size of the window.

This is version 3.0 (sep 19, 2006). The previous posted code of version 1.3 is attached at the end.

인용 양식

Jos (10584) (2024). RUNMEAN (https://www.mathworks.com/matlabcentral/fileexchange/10113-runmean), MATLAB Central File Exchange. 검색됨 .

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

Community Treasure Hunt

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

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

Major change (1.3 - 3.0): can now operate along specific dimension, and contains several possible treatments of the edges.