# Notch filtering minimizing artifacts in signal

I have to notch filter the following signal

As you can see it is a signal with really high amplitude.And this causes me a lot of problems. I've designed a bandstop filter (46-55 Hz).The MATLAB code is

Fs=5000; sampling frequency

Wp_NOTCH = [36/(Fs/2) 71/(Fs/2)];
Ws_NOTCH= [46/(Fs/2) 55/(Fs/2)];
Rp_db=-20*log10(.95);
Rs_db=-20*log10(.05);
[order_NOTCH,wn_NOTCH] = buttord(Wp_NOTCH,Ws_NOTCH,Rp_db,Rs_db);
[B_NOTCH,A_NOTCH]=butter(order_NOTCH,wn_NOTCH,'stop');


And the filter is When i filter the signal (using filtfilt) I've the following signal As you can see it has a lot of artifacts,and "waves". Is there a way to minimize these artifacts?How can I delete the 50Hz component minimizing these artifacts?Any suggestion? Thanks in advance

• Is the first screenshot a time signal? It looks like one. If this is the case, then you won't accomplish anything with a notch filter. This calls for a simple attenuation. – Max Jul 4 at 9:59
• Yes xaxis is time (ms).What do you mean for simple attenuation? – Edoardo De Gaspari Jul 4 at 10:37
• A notch filter is only useful if there is a strong peak at a certain frequency in the spectrum. Looking at your signal, there will be no strong peak in the spectrum, which instead will be rather flat. You wrote that you have a problem with the rather high amplitude. This could be attacked by some attenuation ("make the signal quiter"). No fiddling with filters required, just multiply the signal by e.g. $0.1 = 20\text{dB}$. – Max Jul 4 at 10:48