# Find output of digital filter given input and transfer function?

Hey guys so I have an input sequence that are real values that represent intensity of a column of an image. I also have the transfer function in the Z domain of a 2nd order high pass filter. I have the following transfer function using the bi-linear transform estimate.

Say my input signal is defined as x[n] = 27, 588, 1013, 255, 38. How can I determine the output y[n]?

There are two options, one being I determine X[z] then multiply it by H[z] and take the inverse transform.

The other being I transform H[z] into h[n] and then I convolve it with x[n] using the following scheme .

How would I implement either of these solutions in code (eg. coding an automatic way to generate X[z] from an arbitrary x[n] OR programming a convolution function that implements FOIL for the second option)?

Is one easier than the other? Keep in mind that my signal is 512 samples in length as well, so convolution may be very expensive.

## 2 Answers

Standard difference equation of a biquad: y[n] = b0*x[n]+b1*x[n-1]+b2*x[n-2]-a1*y[n-1]-a2*y[n-2];

Initialize all x[n], y[n] to 0 for n < -1

b0,b1,b2 are 0.86 -1.72 0.86 (numerator)

a0,a1,a2 are 1 -1.71 0.73 (denominator)

• Hey Hilmar, will this give me the same answer as my methods suggested above? If so, how can I prove this to someone? Commented Oct 31, 2013 at 17:36
• Many DSP textbooks include a proof of the biquad recurrence in the chapter on Z transforms (or maybe the chapter after). Commented Oct 31, 2013 at 19:13

Convolution will not suffice, as the impulse response of your filter seems to be infinite. You need to ,,implement'' the filter, as Hilmar suggested. Look up ,,direct form'' 1 or 2. Numerics software usually includes functions exactly for this case. In the case of GNU Octave or similar programs, the function is called ,,filter''.