I'm currently working on rectifying a respiratory noisy signal shown below:
I've already tried to filter the noise as you can see in the image below (full image):
The red one is the noisy signal whereas the blue one is the one got after applying the non-linear detrending:
dt_ecgl = detrend(ecgl);
opol = 6;
[p,s,mu] = polyfit(t,ecgnl,opol);
f_y = polyval(p,t,[],mu);
dt_ecgnl = ecgnl - f_y;
And the green one is the reference signal (correct one) which I'm aiming to have as result of filtering. So my question is how can I acheive a better result? My goal is to have the blue and the green ones conbined (same exact shape) in other words how can I denoise such deformed signal in MATLAB or using any other platform?.


Note that you aren't really removing the noise per-se, but just the frequencies that contain a lot of noise. If the noise falls withing the bandwidth of the signal, it will be much more difficult to remove.
– Dole May 30 '16 at 11:04