I tried to use bessel filter from here, but in the case of a large dataset, I have overshoot. Since I know a bessel filter shouldn't have overshoot, is this code wrong or am I doing something else wrong?
// Sample rate : 1e9
// Cut off Frequency : 50e6
int s=50000;
double[] sample = new double[s];
for(int i=s/2; i<s; i++) {
sample[i] = 1.0;
}
for (int i = 0; i<sample.length; i++) {
xv[0] = xv[1];
xv[1] = xv[2];
xv[2] = xv[3];
xv[3] = sample[i] / GAIN;
yv[0] = yv[1];
yv[1] = yv[2];
yv[2] = yv[3];
yv[3] = (xv[0] + xv[3]) + 3 * (xv[1] + xv[2])
+ ( 0.3402988787 * yv[0])
+ ( -1.4152725242 * yv[1])
+ ( 2.0223552191 * yv[2]);
filteredValue[i] = yv[3];
}
All coefficients have been calculated based on source on given website, it might been messy because its used for chebyshev and butterworth filters as well.