我用C按照以上资料写了一段计算程序,但运行结果不对,请帮我看看哪里搞错了,谢谢:
float w0,sn,cs,alpha,gainLinear;
float a2,a1,a0,b2,b1,b0;
float Gain=0;
float f0=1000;
float bandwidth=1.41;
w0 = 2*3.1415926*f0/48000 ;
gainLinear = pow(10,(Gain/20));
alpha = sin(w0) * sinh( 0.69314718055994530941723212145818/2 * bandwidth * w0/sin(w0));
a0 = 1 + alpha ;
a1 = -2*cos(w0) ;
a2 = 1 - alpha;
b0 = alpha * gainLinear ;
b1 = 0;
b2 = -alpha * gainLinear;
正确结果应该是:
a2:-0.87519109249115
a1:1.85914862155914
b2:-0.0624043941497803
b1:0
B0:0.0624043941497803
但实际运行结果却是:
a2:-0.933442
a1:1.98289
b2:-0.0665579
b1:0
B0:0.0665579
我用C按照以上资料写了一段计算程序,但运行结果不对,请帮我看看哪里搞错了,谢谢:
float w0,sn,cs,alpha,gainLinear;
float a2,a1,a0,b2,b1,b0;
float Gain=0;
float f0=1000;
float bandwidth=1.41;
w0 = 2*3.1415926*f0/48000 ;
gainLinear = pow(10,(Gain/20));
alpha = sin(w0) * sinh( 0.69314718055994530941723212145818/2 * bandwidth * w0/sin(w0));
a0 = 1 + alpha ;
a1 = -2*cos(w0) ;
a2 = 1 - alpha;
b0 = alpha * gainLinear ;
b1 = 0;
b2 = -alpha * gainLinear;
正确结果应该是:
a2:-0.87519109249115
a1:1.85914862155914
b2:-0.0624043941497803
b1:0
B0:0.0624043941497803
但实际运行结果却是:
a2:-0.933442
a1:1.98289
b2:-0.0665579
b1:0
B0:0.0665579
举报