I have designed a 2nd order low pass butterworth filter for the following:
Sampling Frequency: 10kHz. Cut-off Frequency: 1kHz
After doing a bit of maths I worked out the difference equation:
w=tan(1000*pi / 10000) = 0.3249 H(Z) = 0.06747(z + 1)^2 / z^2 - 1.143z +0.413
Poles / Zeroes:
a1=1.143, a2=-0.413, b0=0.06747, b1=0.13494, b2=0.06747
$$y[n] = 0.06747x[n] + 0.13494x[n-1] + 0.06747x[n-2] + 1.143y[n-1] - 0.413y[n-2]$$
Difference Equation in C#
Y[n] = a1 * Y[n - 1] + a2 * Y[n - 2] + b0 * Signal[n] + b1 * Signal[n - 1] + b2 * Signal[n - 2];
The problem I'm having is trying to plot the frequency response using a Bode Diagram (i.e the low pass filter curve).
I'm struggling to understand how the difference equation can be used to plot the bode diagram. How can I do it? I understand that it must be dB magnitude.
Y[n] I need to input a signal into the
Signal[n] array. I should be able to produce a graph that looks something like this: