max - MATLAB finding local maximum in certain range -
figure above time domain signal , area enclosed in black area of interest.
what want following:
identify global minimum point
find local maximum point comes before global minimum point
i have succesfully identified global minimum point this:
ii=1:size(1) jj=1:size(2) [min_amp, min_index]=min(signal(ii,jj,:)); min_time(ii,jj)=time(min_index); end end minbound = floor(mean(min_time(:))*fs);
size(1) , size(2) represent scan area , tried find time @ global minimum occurs @ each point , took average.
can me
2. find local maximum point comes before global minimum point?
thanks in advance
it not clear how variable signal (3d) orientated. assume third dimension time, otherwise search minimum not make sense.
once identified minimum
[min_amp, min_index]=min(signal(ii,jj,:));
you have index (min_index) located, , have restrict search maximum until point (as has before that).
[max_amp, max_index]=max(signal(ii,jj,start_index:min_index));
as mentioned before, not aware of dimensions of signal, whether epoch in black-framed area or entire time series. depending on start_index can either 1 or start index of black-framed epoch.
you should consider check whether maximum real peak or biggest value @ beginning of interval.
have @ build-in function
findpeaks
it searches local maxima. find minima invert signal. , restrict maxima search again on interval before minimum.
Comments
Post a Comment