# Filters performance analysis

I am working on some experimental data which, at some point, need to be time-integrated and then high-pass filtered (to remove low frequency disturbancies introduced by integration and unwanted DC component).

The aim of my work is not related to filtering, but still I would like to analyze more in detail the filters I am using to give some justification (for example to motivate why I chosed to use a 4th order filter instead of a higher/lower one).

This is the filter I am using:

delta_t = 1.53846e-04;
Fs = 1/delta_t;
cut_F = 8;
Wn = cut_F/(Fs/2);
ftype = 'high';
[b,a] = butter(4,Wn,ftype);
filtered_signal = filtfilt(b,a,signal);


I already had a look here: https://stackoverflow.com/questions/5591278/high-pass-filtering-in-matlab to learn something about filters (I never had a course on signal processing) and I used

fvtool(b,a)


to see the impulse response, step response ecc. of the filter I have used.

The problem is that I do not know how to "read" these plots.

What do I have to look for?

How can I understand if a filter is good or not? (I do not have any specification about filter performances, I just know that the lowest frequency I can admit is 5 Hz)

What features of different filters are useful to be compared to motivate the choice?

For example, what info can I see plotting the round-off noise power spectrum of 2 different filters?(high pass Butterworth of different orders: 4 and 22)

EDIT

I tried decimating the signal to reduce the sampling frequency as suggested in the comments and this is what I get

The green one is the new filter's round off noise spectrum having reduced the sampling frequency (now = 325 Hz), the blue one is the older with sampling frequency = 6.5 kHz.

Things look a bit better but still not good enough, am I right?

• Your filter cut off frequency (8Hz) is very, very small compared with your sampling frequency (6500Hz). That probably means the filters you have designed are not doing what you want: this can be seen by the VERY large attenuation at higher frequencies --- not what is wanted in a high pass filter. You should either make the cut off frequency much higher, or seriously down-sample your data (after low-pass filtering it to avoid aliasing).
– Peter K.
Dec 9, 2014 at 22:07
• Since my signal is in the range of frequencies 5-100 Hz I think I cannot increase the cut off frequency too much, also because the info I am interested in starts at 30 Hz. To downsample should I apply the so called decimation or the interpolation techniques?
– Rhei
Dec 10, 2014 at 6:08
• I tried decimation. The result is posted in the EDIT
– Rhei
Dec 10, 2014 at 20:48
• Yes, that still doesn't quite look right. I'll try posting an example later tonight (my time; about five hours from now).
– Peter K.
Dec 10, 2014 at 20:55
• Thank you! By the way, after decimation I checked the signal spectrum and it is really similar to the original one, therefore I did not use any filter...is this the correct way to do it? Because it is the first time I decimate a signal so I might miss something
– Rhei
Dec 10, 2014 at 21:44

OK, doing a design of a Butterworth high pass filter with a cutoff frequency of 8Hz and a sampling frequency of 325Hz using scilab by:

 bw = iir(4,'hp','butt',[8/325 0.5],[0.1,0.1]);


then the filter is:

                                  2
0.8168388 - 3.2673552z + 4.9010328z
3            4
- 3.2673552z + 0.8168388z
------------------------------------
2
0.6672256 - 2.9384352z + 4.8677204z
3   4
- 3.5960396z + z


and the frequency response looks like:

So I'm not sure what you're doing for the design, but it doesn't appear to be high pass.

One thing that may help is if you could share what your data looks like (say 256 or so points?).

• What I was plotting is the round-off noise power spectrum of my filters. Wheras the magnitude and phase are the following:i64.photobucket.com/albums/h182/Olgola/filter_mag_phase.jpg This is the filter designed using the "minimum order" option of the fdatool (which results in a 22nd order filter). If I set the order equal to 8 I got a quite different behavior in terms of round-off noise spectrum i64.photobucket.com/albums/h182/Olgola/8noise_spec.jpg
– Rhei
Dec 12, 2014 at 13:52
• That's why I posted this question: I do not know how to deal with all these "features" which describe the filter behavior. I had a look at some books on signal processing (for example Oppenheim, Lyons and Smith) but I get lost in the mathematics...I need something more easy just to understand what I am doing (also because, as I said, the aim of my work is not signal processing, therefore I cannot spend too much time trying to understand how things work)
– Rhei
Dec 12, 2014 at 13:57
• OK, so it look like your first filter is OK. Your second filter looks like it's an "all stop" filter (i.e. no frequencies get through).
– Peter K.
Dec 12, 2014 at 17:42