Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Find the interval of an envelope corresponding to a specific peak after peak detection
조회 수: 1 (최근 30일)
이전 댓글 표시
I have done the peak detection to find the highest peak in the image below. How do I find the interval of the envelope corresponding to that peak?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208938/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208938/image.jpeg)
댓글 수: 0
답변 (1개)
KSSV
2019년 3월 18일
Let (x,y) be your data.
[val,idx] = max(y) ;
x_max = x(idx) ;
y_max = y ;
Read about max
댓글 수: 10
KSSV
2019년 3월 18일
load('peak_data.mat') ;
y = MDL_1_env_norm ;
x = 1:length(y) ;
%
threshold = 0.01 ;
x1 = x ;
y1 = y ;
y1(y>threshold) = NaN ;
x1(isnan(y1)) = 0 ;
% Seeprate nans seperately
ii = zeros(size(x1));
jj = x1 > 0;
ii(strfind([0,jj(:)'],[0 1])) = 1;
idx = cumsum(ii).*jj;
out = accumarray( idx(jj)',x1(jj)',[],@(x){x'});
idx0 = out{1}(end) ;
idx1 = out{2}(1) ;
idx2 = out{2}(end) ;
idx3 = out{3}(1) ;
idx = [idx0 idx1 idx1 idx2 idx3] ;
plot(x,y,'r') ;
hold on
plot(x(idx),y(idx),'*b') ;
![untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/208962/untitled.png)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!