How to find the first edge (not minimum value) after the peak?

3 ビュー (過去 30 日間)
Vanessa Phung
Vanessa Phung 2017 年 7 月 26 日
回答済み: Star Strider 2017 年 7 月 26 日
The subplot 1 shows a line profile across a density column. I want to find the radius of this column by getting the coordinate of peak(max) and the first edges. The problem is that the edge is not at minimum value, therefore I can't use min().
The subplot 2 is obtained from findpeaks().
figure; imagesc(FT_phase_shift), colorbar;title('Phase shift'); aline=FT_phase_shift(1:600,700); amax=max(aline);amin=min(aline) pmax =find(aline==amax(:,1));pmin=find(aline==amin(:,1));x_max = aline(pmax);
% find peaks and location [pks, locs]= findpeaks(aline); figure;subplot (211); plot(aline); subplot(212); plot(locs, pks);
Please comment.Thank you.

採用された回答

Star Strider
Star Strider 2017 年 7 月 26 日
I would use findpeaks on the negative of your signal:
[negpks, neglocs]= findpeaks( -aline );
Then take the first ‘neglocs’ value less than the maximum peak ‘locs’ value, and the first ‘neglocs’ value greater than the the maximum peak ‘locs’ value. Use the corresponding ‘negpks’ values (as ‘-negpks’) to find the values you want.
Example
x = linspace(0, 10*pi); % Create Data
aline = abs(sin(x-5*pi)./(x-5*pi))*7; % Create Data
[pks, locs]= findpeaks(aline, 'MinPeakHeight',5);
[negpks, neglocs]= findpeaks( -aline );
minidx = find(neglocs < locs, 1, 'last');
maxidx = find(neglocs > locs, 1, 'first');
minloc = neglocs(minidx);
maxloc = neglocs(maxidx);
figure(1)
plot(x,aline,'-b', x(locs),pks,'^r')
hold on
plot(x([minloc maxloc]), aline([minloc maxloc]), 'vr')
hold off

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by