Info

This question is closed. Reopen it to edit or answer.

Find the interval of an envelope corresponding to a specific peak after peak detection

1 view (last 30 days)
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?

Answers (1)

KSSV
KSSV on 18 Mar 2019
Let (x,y) be your data.
[val,idx] = max(y) ;
x_max = x(idx) ;
y_max = y ;
Read about max
  10 Comments
KSSV
KSSV on 18 Mar 2019
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

Community Treasure Hunt

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

Start Hunting!