I know this is a very basic question and I am coming out from a quarter of DSP. I want to create a function in Java which can taken in two parameters, either (double centerFrequency, double bandWidth) or (double startFrequency, double cutoffFrequency).
Based on the information I've gathered, I want a non-ideal IIR filter because this is for a project I am doing with an accelerometer that needs to be updated real-time. Hopefully I am not going too much into programming, but the general form of my filter function would be like this:
double BPFilter(double x, double centerFrequency, double bandWidth) {
double filteredY;
static double[] y = {0, 0, 0};
//y[0] represents y[n]
//y[1] represents y[n-1]
//y[2] represents y[n-2]
y[0] = A*y[2] + B*y[1] + C*x;
y[2] = y[1];
y[1] = y[0];
return y[0];
}
What would be the best way to calculate A, B, and C? Currently I know how to do continuous transfer functions, $H(s)$, so if that is translatable to A, B, and C I could do it that way. The sampling rate is at $100\textrm{ Hz}$.
TL;DR: Discretize a continuous transfer function by hand (no MATLAB)