フィルターのクリア

Hi, how can I divide this signal into 3 segments? The first segment I want to be the signal before the major peak, the second segment would be the major peak and the last segment would be the signal after the peak.

3 ビュー (過去 30 日間)
The first segment I want to be the signal before the major peak, the second segment would be the major peak and the third segment would be the signal after the major peak. You can find the signal attached.

採用された回答

Star Strider
Star Strider 2018 年 12 月 29 日
One approach:
The Code —
D = load('signals (1).mat');
Signal = D.Signal; % Get ‘Signal’
N = length(Signal);
t = linspace(0, 1, N) * N; % Create Time Vector
[pk,loc] = findpeaks(Signal, 'MinPeakHeight',1); % Determine Indices Of Various Components
[trofs,trlocs] = findpeaks(-Signal);
ltidx = find(trlocs < loc, 1, 'last');
gtidx = find(trlocs > loc, 1, 'first');
Out{1} = {Signal(1:trlocs(ltidx)); Signal(trlocs(ltidx)+1:trlocs(gtidx)-1); Signal(trlocs(gtidx):end)}; % ‘Signal’ Cell Array
Out{2} = {t(1:trlocs(ltidx)); t(trlocs(ltidx)+1:trlocs(gtidx)-1); t(trlocs(gtidx):N)}; % ‘t’ Cell Array
figure
plot(Out{2}{1}, Out{1}{1}, 'r')
hold on
plot(Out{2}{2}, Out{1}{2}, 'g')
plot(Out{2}{3}, Out{1}{3}, 'b')
hold off
grid
The Plot —
HI_HOW~1.PNG
  7 件のコメント
Hannah Oduntan
Hannah Oduntan 2018 年 12 月 29 日
Both ways are perfectly fine, thank you.
Star Strider
Star Strider 2018 年 12 月 29 日
As always, my pleasure!
@IA — Thank you.

サインインしてコメントする。

その他の回答 (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