# Implementing digital filter by padding with zeros

I am making a 9th order digital bandpass filter with lower and upper corners of 200 kHz and 40 MHz respectively. I am using this filter to filter a 1D time domain signal which is 64k samples long sampled at a frequency of 150MHz.

I have done some digital filtering before in university, so I know what to expect, but it's been a while.

I have used this site: http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html to generate the filter coefficients and the gain, and I can see how the code works, my question is this:

I start with the value of X[0], then to calculate the value of Y[0] I need values for Y[-1] ... Y[-18] and x[-1] ... X[-18].

I know these do not exist, so I think (from what I remember from university) that I pad with zeros, however, doing a bit or reading I heard it mentioned that padding with zeros changes the sampling frequency.

So how do I go about calculating this new sampling frequency (if indeed required..)?

• You just use zero initial conditions, i.e. your delay line has all zeros in it. And your input signal is also zero before it actually starts. This is exactly what you describe as 'zero padding'. Sep 23 '14 at 16:37
• Padding a signal with zeros on one end doesn't change its sampling frequency at all. Sep 24 '14 at 0:06

## 1 Answer

Zero padding your input signal does not change your sampling frequency, it just changes (in this case probably very slightly) the time duration of your input signal. An example would be that whether you filter one second's worth of data or two second's worth of data doesn't have any impact on the sampling frequency of the data.

One thing to keep in mind is that there will be a start up transient when zero-padding because your input signal instantaneously goes from zero to the value of the signal, essentially applying a step function on top of your signal of interest. Generally speaking, you'll want to make sure you have some amount of data before a feature you're really interested in to make sure the start up effects have sufficient time to decay. The website you mention gives the step response of the generated filter so you can check to see what effect it will have on your signal of interest.