フィルターのクリア

How to index equally spaced chunks from a long signal?

3 ビュー (過去 30 日間)
Careniena Opem
Careniena Opem 2022 年 2 月 14 日
編集済み: David Hill 2022 年 2 月 14 日
I have a long signal that includes 120 stimulation pulses evenly spaced. I have the indices of these pulses and I want to find the mean of the signal from 5-7 ms after each pulse to use as a baseline value. Currently, I am extracting individual pulses and able to find the mean of this time period from individual pulses, but how can I find the mean from all of them at once?
for b = 1:numPulses
windowBefore = round(0.001*db1.Fs);
windowAfter = round(0.05*db1.Fs);
window1 = -windowBefore:windowAfter;
windowSelected = window1 + pulseIndexes(b);
signal = db1.emg(windowSelected,d);
m = mean(signal(ceil(Fs*0.005):ceil(Fs*0.007)))

回答 (2 件)

David Hill
David Hill 2022 年 2 月 14 日
編集済み: David Hill 2022 年 2 月 14 日
ms5=1000;%approximate number of data samples after the pulse to start averaging on (should be based on your sample frequency)
ms7=1400;%approximate number of data samples after the pulse to stop averaging on (should be based on your sample frequency)
m=arrayfun(@(x)mean(yourData(indexOfPulses(x)+ms5:indexOfPulses(x)+ms7)),1:numel(indexOfPulses));

Benjamin Thompson
Benjamin Thompson 2022 年 2 月 14 日
If you can define an index vector with ones in the positions where you want to calculate the mean, then you can use the index vector to pass a smaller subset of your data to the mean function. For example, to get the mean of all samples exceeding 1 in a sinusoid of frequency 2, amplitude 2 ,for 5 seconds:
>> t = 0:0.01:5;
>> x = 2*sin(2*pi*2*t);
>> figure, plot(t, x)
>> Ipulse = x > 1;
>> mean(x(Ipulse))
ans =
1.6808
>>

カテゴリ

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