フィルターのクリア

How do I get a maximum and minimum for a singular wave while ignoring the other local maximums and minimums?

2 ビュー (過去 30 日間)
I have wave data from a buoy and am trying to identify the overall crest and trough amplitude for 50 individual waves. However, when using islocalmax/min it identifies all the locals and not the highest absolute value. I tried using minprominence but the amount of data points for each crest and trough is inconsistent. The section of code I'm using is below(original data file is .dat extension so I converted to .txt to upload here).
filedata=load('waves_n_130.dat');
A= filedata(:,4);
for n=1:8191
wmin=islocalmin(A,'MinProminence',0);
wmax=islocalmax(A,'MinProminence',0);
end

採用された回答

Star Strider
Star Strider 2022 年 10 月 10 日
LvPks = islocalmax(y, 'MinProminence',0.01, 'MinSeparation',45); % 'islocalmax'
plocs = find(LvPks);
pks = y(plocs);
[maxpk,ploc] = max(pks)
This returned:
maxpk = 0.2899
ploc = 79
and:
[mintr,tloc] = min(trs)
returned:
mintr = -0.3222
tloc = 77
And this:
Pk_Tr_Amp = pks(1:end-1)-trs;
[maxamp,loc] = max(Pk_Tr_Amp)
returned:
maxamp = 0.5668
loc = 77
Just add those lines (and perhaps others) to my code to get the results you want.
NOTE — There is one more peak than trough, and the vector lengths must be equal in order to compare them.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by