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.
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 &lt; -1

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

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