# Filter order and cut off frequency

How can I know exactly what frequencies are not influenced by the filter?

I mean, I have a signal in the range of frequencies $5-100 Hz$ and I apply a high-pass, $4^{th}$ order Butterworth filter with cut-off frequency of $8 Hz$. The filter will not cut sharply at $8 Hz$, instead it will have a slope related to the filter order: the higher the order, the steeper the slope right?.

So, how can I compute the frequency from which the signal is left unchanged (so no attenuation due to the filter)?

Is there a way to obatin this info directly in matlab?

This answer is written in terms of low-pass but the ideas directly translate to high pass.

A butterworth filter (low pass) of order $N$ with cutoff $\Omega_c$ is one which has a maximally flat passband, and has the squared magnitude response $|H(j \Omega)|^2 = \frac{1}{1+\left(\frac{j \Omega}{j \Omega_{cutoff}}\right)^{2N}}$. [I'm just writing it this way so that if you try to get a realizable transfer function via spectral factorization it is easy].

So, you specify the cutoff $\Omega_c$ and it gets sharper as you increase the filter order. Strictly speaking, from the the squared magnitude response, you see that $|H(j \Omega)|^2=1$ if and only if $\Omega=0$, i.e. only the DC component is un-modified. However, from that formula, you can calculate things like frequencies where the magnitude is within say 99% of the original magnitude, by finding $\Omega$ such that $|H(j \Omega)|^2 \geq 0.99^2$ (note that $|H(j \Omega)|^2$ is monotone decreasing in $\Omega$, so your range will be of the form $[-\Omega_{0.99},\Omega_{0.99}]$). Similar properties of other filters will hold as well - see Appendix B of Discrete-Time Signal Processing 2e by Oppenheim, Schafer and Buck for more details. Make sure you're familiar with the basic types of filters as well -- elliptical, butterworth and chebyshev to make sure your characteristics you desire are matched to what you want.

If you want to design filters with particular passband and stopband characteristics in the FIR case (such as controlling the maximum error), you may want to look at the Parks-Mclellan algorithm (described in Discrete-Time Signal Processing 2e by Oppenheim Schafer and Buck, ch. 7).

As for Matlab usage, you can plot the magnitude response of the filter and determine these things. It can be done from the filter visualization tool. TI also makes a filter design tool which is quite nice, called FilterPro.

• One more question, if I use the matlab function filtfilt() to apply the filter to my signal instead of using filter(), do I have to change the way in which I am defining the filter parameters? Or I can still write this way [b,a] = butter(4,8/(Fs/2),'high'); acc_t = filtfilt(b,a,acc_t); – Rhei Dec 7 '14 at 14:42
• do you know the difference between filtfilt and filter? – Batman Dec 7 '14 at 14:47
• I know that the filtfilt() allows not to have phase distortions because it filters both forwards and backwards, but how does it influence the cut-off frequency and the filter order? (IF it influences them) – Rhei Dec 7 '14 at 15:13
• I had a more careful look at the help page of filtfilt() and it actually says the filter order is doubled. What I still do not understand is: since I use filtfilt() do I have to consider an $8^{th}$ order Butterworth filter when doing the filter analysis or a $4^{th}$ order one? Because the order is doubled, but actually the signal is filtered twice with the order 4. This question came up into my mind because the fvtool(b,a) says that the $8^{th}$ order filter is unstable, whereas the $4^{th}$ order one is stable – Rhei Dec 8 '14 at 10:02

Cut off frequency can be considered as the frequency till which the response is flat for practical purposes.In reality at cut off frequency it is 1/sqrt(2) times max amplitude

So, how can I compute the frequency from which the signal is left unchanged (so no attenuation due to the filter)?

No - such a frequency does not exist because this would imply that you could realize something like a "brickwall" filter. Even far beyond the so-called end of the passband (this applies to a lowpass) the signal properties (magnitude and phase) are changed (theoretically!) with respect to the input signal. You only can specify an upper limit for the amount of these signal modifications changes (magnitude or phase).