フィルターのクリア

Searching for structures in signal

2 ビュー (過去 30 日間)
Sebastian Daneli
Sebastian Daneli 2021 年 6 月 14 日
コメント済み: Star Strider 2021 年 6 月 14 日
I have a filtered signal were the base line is zero. I wish to search this signal for structures, i.e., find all the values in between the zeros, and store these induvidual structures as individual vectors for later comparison. These structures are not of equal length. How do I do this efficiently?

採用された回答

Star Strider
Star Strider 2021 年 6 月 14 日
Try this —
t = linspace(0,25, 500); % Create Data
signal = sum(sin(0.5*rand(5,1)*2*pi*t+rand(5,1)*pi)); % Create Data
zxi = find(diff(sign(signal))); % Indices Of Approximate Zero-Crossings
tlen = numel(t);
for k = 1:numel(zxi)
idxrng = max(1,zxi(k)-2):min(zxi(k)+2,tlen); % Index Range For Interpolation
ti(k) = interp1(signal(idxrng), t(idxrng), 0); % 'Precise' Zero-Crossings
end
for k = 1:numel(ti)-1
tc{k} = t(t>=ti(k) & t<ti(k+1)); % Time Vector Between Zero-Crossings
sigc{k} = interp1(t,signal,tc{k}); % Associated Signal Vector
end
figure
plot(t, signal)
hold on
plot(t(zxi), signal(zxi), 'sr')
hold off
grid
title('Original Signal & Approximate Zero-Crossings')
sps = numel(tc);
for k = 1:sps
subplot(ceil(sps/3),3,k)
plot(tc{k}, sigc{k}, 'LineWidth',1.2)
grid
title(sprintf('Segment #%02d',k))
end
sgtitle('Signal Segments Between Zero-Crossings')
.
  2 件のコメント
Sebastian Daneli
Sebastian Daneli 2021 年 6 月 14 日
I will, thx.
Star Strider
Star Strider 2021 年 6 月 14 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by