MATLAB: SNR estimation from single vector

Signal Processing Toolboxsnr signal processing

I'm interested in estimating the SNR of a signal with a wandering mean and no defined "signal" and "noise" vector. I have the following data, call it x:
My initial thought was to run it through a high-pass filter with a really low cutoff to get a steady, zero-mean signal. Then I would take the amplitude of the signal over the variance of the entire signal:
SNR = min(x)^2/var(x)
However, I have a feeling this is overly complicated and not a very good estimation. Thoughts?

Best Answer

Maybe try a Savitzky-Golay filter. Experiment around with different orders and window widths until you achieve the "look" you want. I attach a demo.