the coefficient formulae come from a z-transform of the transfer function and seem to be correct (well at least theyre returning realistic numbers
)the problem seems to be coming from the actual filter itself - it jumps directly to infinity when the feedback is introduced
- Code: Select all
streamin in;
streamout out;
streamin k;
float k2, k3;
float z0,z1,z2,z3;
float a0,a1,a2,a3;
float b0,b1,b2,b3;
float c0P5=0.57735;float c1P31=1.3107;
float c1P35=1.35897;float c1P7=1.73205;
//precalc
k2=k*k;
k3=k2*k;
//calculate coefficients
a0=c0P5*k3;
a1=c1P7*k3;
a2=c1P7*k3;
a3=c0P5*k3;
b0=c0P5*k3 + c1P35*k2 + c1P31*k + 1;
b1=c1P7*k3 + c1P35*k2 - c1P31*k - 3;
b2=c1P7*k3 - c1P35*k2 - c1P31*k + 3;
b3=c0P5*k3 + c1P35*k2 + c1P31*k - 1;
//filter
z0 = in + b1*z1 - b2*z2 - b3*z3;
out= a0*z0 + a1*z1 + a2*z2 + a3*z3;
z3=z2;
z2=z1;
z1=z0;



















