Filtering Surge Signals I am working on a matlab program which needs me to detect the pattern of surges in a signal and then remove them. I tried out various filters like median, hampel, butterworth etc. but couldn't get an effective output.
Here's a snap of my signal :

Now, I need to filter out the surges. Could anyone please suggest me a method on how to approach this problem? Sampling frequency is 4khz and No. of data points is 40k.
Sounds like a job for dedicatedly identifying these surges and then actually subtracting them.

I'd start with a low-pass filter to find the slightly time-varying mean of the signal.

Use that to define lower and upper thresholds above or below you count something as surge.

Identify the samples lying outside the thresholds. Find a signal model for surges, e.g. a (truncated) sin x/x function or a quadratic function. Fit that model to the surge samples and then subtract from the signal.