In this paper we propose a novel approach for estimating narrowband components from bioelectrical signals. The approach is based on the notion of modulated quadratic variation, introduced as a measure of variability for narrowband signals. The algorithm is the closed-form solution to a constrained convex optimization problem, where narrowband components are estimated tracking the slow variations around a central frequency in the measured signal. The approach is general and can be applied to any bioelectrical signal, either for diagnostic or denoising purposes. In this paper we assess its performance on ECG and EMG signals. Numerical results show its effectiveness in removing narrowband artifacts, such as power-line interference, while prese...