Removing artifacts from a signal
Show older comments
I want to get the Stim-on and Stim-off times from a dataset of continous data, but am running into problems with artifacts occurring mid-pulse.
How can I remove these erroneous spikes from stimulation data, without shifting the rest of it?
Savitsky-Golay filter didn't work, template matching using convolution is not possible because the pulses are different widths.



1 Comment
Abhilash
on 9 Nov 2020
The artifacts are not always mid pulse. They also differ in magnitude. But they are always just 1 sample wide. We also tried normalising the signal and using the first differential but because of this high-frequency noise, it doesn't work.
Answers (1)
Mathieu NOE
on 9 Nov 2020
0 votes
hi
maybe you can localize the artifacts by using the attached function (zero crossing)
artifacts will have two very nearby zero crossing time index, with opposite slopes (set threshold slightly below max amplitude)
so you can smooth out or remove the wrong values (and interpolate) inside some limited bins of values
2 Comments
Abhilash
on 11 Nov 2020
I think Maria tried this, but it didn't work completely. SHe was able to remove like 95% of the artifacts but not all.
Mathieu NOE
on 12 Nov 2020
hello
so putting the crossing threshold around 2.7 does not remove 100% of the artifacts ?
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!