Hi! I'm simulating a Direct Form 1 biquad using fixed point arithmetic in Matlab, and I'm having some problems with frequency response errors at low frequencies compared to floating point filtering. The errors are not due to coefficient quantization, but originates from the quantization after the accumulator in the feedback path of the biquad. I'm simulating a 24-bit architecture (I'm not taking overflow into account, only quantization noise). Take a look at the following picture, that shows the frequency and impulse response of a 2:nd order high-pass butterworth filter created with the command: [B,A] = butter(2,50/(fs/2),'high'); http://dl.dropbox.com/u/10432980/woESS.png Note that the low frequency performance of the fixed point implementation is really bad. The impulse response (which scale is zoomed in) shows a small negative DC offset. The fixed and floating point simulations use the same 24-bit quantized coefficients. When 1st order error-shaping is added, with a zero in the complex plane at DC, the result improves somewhat: http://dl.dropbox.com/u/10432980/wESS.png Now there is instead a small positive DC offset. So my question is: Is this the kind of performance that can be expected of a 24-bit fixed point implementation?? Is my simulation incorrect? Below is my filtering loop in Matlab. Input samples and numerator coefficients are quantized to Q1.23, and denominator coefficients to Q2.22 since they have values >1. ----------------------------------------------------------------------- fracBits = 23; % fractal number of bits y(n) = B(1)*x(n) + B(2)*x(n-1) + B(3)*x(n-2) - A(2)*y_1 - A(3)*y_2 + e_1; y(n) = y(n) + e_1; % error shaping y_2 = y_1; y_1 = floor(y(n)*2^-(fracBits-1)); % quantization after "accumulator" e_1 = y(n) - y_1*2^(fracBits-1); % quantization error ------------------------------------------------------------------------ Any help here is greatly appreciated. Best Regards Viktor

# As good as it gets? :( Fixed point frequency response error from quant. noise

Started by ●November 30, 2010

Reply by ●November 30, 20102010-11-30

Okay. 1 minute after I posted this I found the solution: Quant. error was added twize... delete the line y(n) = y(n) + e_1; Then the frequency response becomes perfect. Stupid mistake... I don't know how to delete a thread but someone else might learn from it... /Viktor

Reply by ●August 7, 20142014-08-07

good thing you didn't delete the thread. در سه‌شنبه 30 نوامبر 2010، ساعت 4:18:34 (UTC-8)، luminous نوشته:> Okay. 1 minute after I posted this I found the solution: > > Quant. error was added twize... delete the line > y(n) = y(n) + e_1; > Then the frequency response becomes perfect. > > Stupid mistake... I don't know how to delete a thread but someone else > might learn from it... > > > /Viktor

Reply by ●August 7, 20142014-08-07

>> with frequency response errors at low frequencies compared to floatingpoint filtering. Hi, "but now for something completely different": At low frequencies, you may be better off with a state variable filter: http://www.earlevel.com/main/2003/03/02/the-digital-state-variable-filter/ Everything depends, of course. For example, a 500..5000 Hz lowpass at 96 KHz in 24 bits could give around 110 dB SNR without any "tricks" (such as noise shaping that may be needed in a low-cutoff biquad). _____________________________ Posted through www.DSPRelated.com