Quick search for local extremes

버전 1.0.0.0 (2.13 KB) 작성자: Miroslav Balda
New fast and reliable function for finding local extremes in a real vector.
다운로드 수: 5.6K
업데이트 날짜: 2006/3/13

라이선스 보기

The new function extr.m analyses the given real vector carrying a sequence of samples to be analyzed. At the end, it returns a cell array of extreme positions in the sequence. The cell array consists of two cells only. The first one contains the logical vector of maxima and the other the similar one of minima. Should more equal values be present in adjacent elements of the vector, only one position is returned. The attention is also paid on low memory requirements and a speed of the procedure.

Forms of calls:

L = extr(x); % Find true local extremes

% ..... x vector containing a sequence to be analyzed,
% ..... L cell array {L(1), L(2)}, where
% ..... L(1) is logical vector of positions of maxima,
% ..... L(2) is logical vector of positions of minima.

There are also circumstances, when the processing time is critical for a user, while the exact true extrems are of less priority. In that case he may use:

L = extr(c,0); % Find true and false local extrems.

False extrems form pairs of equal value minimum-maximum laying somewhere on the trend of the sequence. They are not extrems, but they do not harm in certain cases of consecutive processing.

Examples:

demoXtr; % See the program and figure demoXtr.jpg
L = extr(x);
y = x(L(1)|L(2)); % y is a vector of all extremes

clear, x=rand(1e7,1)-.5; tic, L=extr(x); toc
Elapsed time is 2.974584 seconds. % (3GHz PC, Windows XP Prof.)

clear, x=rand(1e7,1)-.5; tic, L=extr(x,0); toc
Elapsed time is 1.392926 seconds. % (3GHz PC, Windows XP Prof.)

Hopefully, the function is error-free. If not, please, let me know.

인용 양식

Miroslav Balda (2025). Quick search for local extremes (https://kr.mathworks.com/matlabcentral/fileexchange/10272-quick-search-for-local-extremes), MATLAB Central File Exchange. 검색 날짜: .

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

Community Treasure Hunt

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

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

Smaller figure