low-pass filtering a signal within a range determined by signal amplitude
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have this problem (see the picture attached). The baseline is noisy, so I have applied a lowpass filter (1 Hz, y=lowpass(I_P,1,6250). The data looks amazing but the spikes are smaller (of course, because I applied a low-pass filter).
So, in short, I want to apply the same low-pass filter (1Hz) exclusively to the baseline, i.e. from -10 pA to + 50 pA, so that the data baseline is improved signal-wise, and the spike amplitude remains untouchable (keeping the real amplitude).
The signal inside the green box is the data I want to filter. The signal inside the red box is the data I do not want to filter.
Thanks
0 件のコメント
採用された回答
Mathieu NOE
2020 年 12 月 15 日
hello Jose
so this is a little code snipset, it uses a windowing technique as low pass filter
the peaks are left as original
you can leave the peks very sharp (one point) or wider if you leave the following line active :
hope it helps !!
%% signal generation
signal = 10*randn(1,samples); % noise
% add some peaks (must NOT be filtered)
signal(100) = 400;
signal(200) = 300;
signal(300) = 200;
signal = myslidingavg(signal, 5); % just a trick to make the peaks a bit wider (optionnal)
%% main code
% sliding avg method
threshold = max(abs(signal))/4;
ind = find(signal< threshold);
out = myslidingavg(signal(ind), 100);
signal_out = signal;
signal_out(ind) = out;
figure(2),
plot(time,signal,'b',time,signal_out,'r');
7 件のコメント
Mathieu NOE
2020 年 12 月 15 日
hi again
glad it finally helped you
to be honest with you and with the person you originally developped the function almost 20 years ago, this was available in the FEX under :
I just improved marginaly the function essentially for my own needs, and more recently to help other people
but I wont take credit for someone else work !
there are also alternatives like fast moving_average.m that seems even more powerful - have to try this one
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!