# Reverse Engineering Bessel LPF (sample frequency needed)

I have the following sourcecode. For all I know, it should be a Bessel LPF at 10Hz. Is there a way to get the sampling frequence out of this?

double LPF(register double value) {
static double buf;
register double tmp, fir, iir;
tmp= buf; memmove(buf, buf+1, 3*sizeof(double));
iir= val * 1.865660386328251e-06;
iir -= 0.9048452950692862*tmp; fir= tmp;
iir -= -1.898666438223082*buf; fir += buf+buf;
fir += iir;
tmp= buf; buf= iir; val= fir;
iir= val;
iir -= 0.8712702520352774*tmp; fir= tmp;
iir -= -1.866439169696869*buf; fir += buf+buf;
fir += iir;
buf= iir; val= fir;
return val;
}

• If you believe that the code implements a Bessel filter with a cutoff of 10 Hz, you can extract the filter coefficients from the above code, plot the response on a normalized frequency axis, then work out what the sample rate must be in order to get that cutoff frequency. It's hard to deduce the structure from the code, shown, however (looks like the component named fir is calculated from feedback through the filter, which doesn't seem to make sense). Also, you haven't shown what val is; the above function wouldn't compile. And, the input argument value isn't referenced anywhere. Nov 6 '12 at 13:27
• Doesn't make sense to me too, thats why I am asking ;) It looks nowhere like the filters I'Ve seen and/or used. Concerning value/val, I suppose it means the sa me and is just a typo. Thanks for noting it anyway. I will try the ploting way.
– hwi
Nov 6 '12 at 13:46