フィルターのクリア

How can I take an average of a signal in order to smooth the data?

3 ビュー (過去 30 日間)
Inteeskimo
Inteeskimo 2017 年 11 月 11 日
コメント済み: Neethu Varughese 2018 年 1 月 6 日
First I need to divide each cycle up. each cycle needs to be divided as: 0.2 seconds before and 0.4 seconds after the highest y value. That way all the cycles will align.
I am quite new to matlab, so sorry I can't even attempt this. Thank you. :)

採用された回答

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2017 年 11 月 11 日
Let t be the set of time points, y your signal, and fs be the sampling rate.
[~,peaks] = findpeaks(y,'MinPeakHeight',1); % select only the highest peaks
segments = arrayfun(@(x) x-round(0.2*fs):x+round(0.4*fs), peaks,'UniformOutput',false);
y_around_peak = cell2mat(cellfun(@(x) y(x), segments ,'UniformOutput',false)');
plot((-round(0.2*fs):round(0.4*fs))/fs,y_around_peak);
If you get an error in line 2, that probably means you don't have enough samples around either the first or the last peak - in that case, replace peaks in line 2 by peaks(2:end-1).
  6 件のコメント
Inteeskimo
Inteeskimo 2017 年 11 月 12 日
never mind, I managed to fix the error myself, thanks for the help!
Neethu Varughese
Neethu Varughese 2018 年 1 月 6 日
what does x stand for here?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by