MINMAX: Generalized median-style filter

버전 (2.47 KB) 작성자: François Beauducel
Generalization of MIN, MAX, MEDIAN and extreme values filtering.
다운로드 수: 767
업데이트 날짜: 2013/3/18

라이선스 보기

A little function that I imagined many years ago: a "median-style" generalized filter. Let's sorting all values of a vector X in ascending order then consider the normalized rank position N of elements:

- N = 0 (first value) corresponds to the minimum of X;
- N = 1 (last value) the maximum;
- N = 0.5 (middle) is the median value;
- So what is N = 0.9 ? Answer is: it's the maximum of X after excluding the 10% highest values.

The proposed function allows a simple generalization of MIN, MAX, MEDIAN and extreme filtering functions, reduced to a single parameter. A typical example of use is minmax(X,[0.01 0.99]) which returns minimum and maximum values of X(:) but excluding the 1% extreme values. This is particularily useful for automatic scaling of noisy data (see the screenshot example), compared to the use of MEAN and STD functions which can be biased by any high-magnitude values in X.

Default behavior of MINMAX is to return a vector of minimum and maximum values. So minmax(X) is an abreviation of minmax(X,[0 1]), and equivalent of [min(X(:)) max(X(:))]. Compared to the built-in functions MIN and MAX, it does not return a vector from matrix but returns a scalar by considering all elements of matrix X. Also, it removes any NaN values (returns NaN only if all X values are NaN).

Type 'doc minmax' for syntax, help and other examples.

인용 양식

François Beauducel (2024). MINMAX: Generalized median-style filter (https://www.mathworks.com/matlabcentral/fileexchange/38573-minmax-generalized-median-style-filter), 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!
버전 게시됨 릴리스 정보

bug correction: now works also with X scalar.