필터 지우기
필터 지우기

find values around peak

조회 수: 4 (최근 30일)
Fabian Laumen
Fabian Laumen 2021년 2월 11일
답변: Image Analyst 2021년 2월 11일
Hey guys,
i have a very simple question. I have a file/array with one million values and a peak. I need to find a way to get 5000 values around this peak in positive and negative direction. In the end i need an array with 10001 values in the direction from the original file/array.
thanks in advance

답변 (1개)

Image Analyst
Image Analyst 2021년 2월 11일
Try this:
[maxValue, indexOfMax] = max(signal);
index1 = max([1, indexOfMax - 5000]); % Don't allow less than 1.
index2 = min([indexOfMax + 5000, length(signal)]); % Don't allow more than the length of your signal.
output = signal(index1 : index2); % Extract
If you have clipping because one index is outside the range, and you still need 10,000 elements, then you can take a few more steps to ensure that.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by