# When input data into a low pass filter, are the first several data unusable?

For example, I want to feed a DC into a low pass filter. The the filter's first several output will not have the same DC value I want.

1. Does it mean that I need to dispose first several results?

2. How many shall I dispose?

3. What is the technical term describing this phenomenon, step response?

4. Does it only happen to DC or to other frequency signals as well?

Here comes sample code and diagram:

Fs = 64e3;
f = 8e3;
T = 1/Fs;
t = 0:T:0.002;
input = 0.002*cos(2*pi*f*t);
input_with_DC = input+0.5;

[b,a]=cheby1(1,2,0.4);
output = filter(b,a,input_with_DC);

plot(input_with_DC)
hold
plot(output,'r')


It can be seen from above diagram that the DC rises at first and then approach to the actual DC value.

• The filter has a delay and its output is not really useful at the start. Picture a FIR filter with many taps, all initially zero. As the signal shifts into the filter, the taps start to "fill out" and the filter's output starts to be meaningful. For $n$ taps, you'll want to wait at least $n/2$ samples before using the filter's output. – MBaz Mar 24 '16 at 13:59
• Thanks for your reply. Why n/2 instead of n? What about for IIR filters? Must we experiment with step responses? – richieqianle Mar 24 '16 at 14:00
• I'm not an expert on filters; $n/2$ is a rule of thumb number based on my experience. There's no harm in discarding the first $n$ samples; it may even be more accurate. – MBaz Mar 24 '16 at 14:03
• – Matthias W. Mar 25 '16 at 11:03
• @MatthiasW. Truly great material. Simple and clear, thanks! – richieqianle Mar 25 '16 at 14:16

You have to judge yourself if for your purposes you need to get rid of the first few output values. The phenomenon you observe is determined by two factors. The first is the delay of the filter (which is usually frequency dependent). This delay is a consequence of the causality of the filter. For a linear phase FIR filter that delay is independent of frequency and equals $(N-1)/2$ samples, where $N$ is the filter length (as pointed out in a comment by MBaz). The other factor lies in the nature of low pass filters and has nothing to do with a non-ideal (causal) implementation. It is the non-zero rise time that any low pass filter exhibits, even an ideal (non-causal) brick-wall filter. The rise time is proportional to the inverse of the cut-off frequency.