m8ta
You are not authenticated, login. |
|
{441} | ||
So, in order to measure how quantizing filter coeficients affects filter response, I quantized the coefficients of a 8th order bandpass filter designed with: [B1, A1] = ellip(4,0.8,70, [600/31.25e3 6/31.25]);here is a function that quantizes & un-quantizes the filter coeff, then compares the frequency responses: function [Bq, Aq, Bcoef, Acoef] = filter_quantize(B, A) % quantize filter coeficients & un-quantize so as to get some idea to % the *actual* fixed-point filter performance. % assume that everything in broken into biquads. base = 10; Aroots = roots(A); Broots = roots(B); order = length(Aroots)/2; % the number of biquads. scale = B(1).^(1/order); % distribute the gain across the biquads. for o = 0:order-1 Acoef_biquad(o+1, :) = poly(Aroots(o*2+1 : o*2+2)); Bcoef_biquad(o+1, :) = poly(Broots(o*2+1 : o*2+2))*scale; end Bcoef = round(Bcoef_biquad .* 2^base); Acoef = round(Acoef_biquad .* 2^base); % now, reverse the process. Bq2 = Bcoef ./ 2^base; Aq2 = Acoef ./ 2^base; for o = 0:order-1 Arootsq(o*2+1: o*2+2) = roots(Aq2(o+1, :)); Brootsq(o*2+1: o*2+2) = roots(Bq2(o+1, :)); end Aq = poly(Arootsq); Bq = poly(Brootsq).*B(1); [H, W] = freqz(B, A); [Hq, Wq] = freqz(Bq, Aq); figure plot(W, db(abs(H)), 'b') hold on plot(W, db(abs(Hq)), 'r') axis([0 pi -100 0])The result: high frequency is not much affected but low frequency is strongly affected. But this is at a quatization to 10 bits - quantization to 15 bits lead to reasonably good performance. I'm not sure if this conclusively indicates / counterindicates downsampling prior to highpassing for my application, but i would say that it does, as if you downsample by 2 the highpass cutoff frequency will be 2x larger hence the filter will be less senitive to quantization errors which affect low frequencies. |