Hi All 1) According to M.Donadio article "Cascaded Integrator-Comb Filter Introduction" Hf = (sin(pi*f*M)./sin(pi*f/R)).^N; where Hf = amplitude response at frequency f M = number of comb delay stages N = number of cascaded comb/integrator pairs R = rate change(up or down) 2) According to Rick Lyon's article "Understanding cascaded Integrator-comb" Hf = (sin(pi*f*D)/sin(pi*f)).^M ..D possibly is M and M possibly is N and R is invisible 3) According to Xilinx article "CIC compiler" Hf = (sin(pi*f*R*M)/sin(pi*f)).^N 4) According to my confused matlab based work on all above formulas, none of them makes sense. What am I missing? I know I can go to Z domain but I just want to sort this equation out. Your help appreciated Kaz _____________________________ Posted through www.DSPRelated.com

# CIC equations mystery

Started by ●September 3, 2014

Reply by ●September 3, 20142014-09-03

On Wednesday, September 3, 2014 4:41:25 PM UTC-4, kaz wrote:> Hi All > > > > 1) According to M.Donadio article "Cascaded Integrator-Comb Filter > > Introduction" > > Hf = (sin(pi*f*M)./sin(pi*f/R)).^N; > > > > where > > Hf = amplitude response at frequency f > > M = number of comb delay stages > > N = number of cascaded comb/integrator pairs > > R = rate change(up or down) > > > > 2) According to Rick Lyon's article "Understanding cascaded > > Integrator-comb" > > Hf = (sin(pi*f*D)/sin(pi*f)).^M > > > > ..D possibly is M and M possibly is N and R is invisible > > > > 3) According to Xilinx article "CIC compiler" > > Hf = (sin(pi*f*R*M)/sin(pi*f)).^N > > > > 4) According to my confused matlab based work on all above formulas, none > > of them makes sense. > > > > What am I missing? I know I can go to Z domain but I just want to sort this > > equation out. > > > > Your help appreciated > > > > Kaz > > > > _____________________________ > > Posted through www.DSPRelated.comGood one! two points that may help clear up the confusion. Normally, you design a CIC decimator such that the rate change is equal to the number of delay stages so that the sinc nulls are aligned correctly (prevents aliasing to DC in the downsampling case). So in Rick's case there is only a single variable D which makes life easier (set it to the rate change). In the actual implementation you end up using the magical Hogenauer trick so that you only end up with single delays. The other variation is related to whether you are up-sampling or down-sampling. In the downsampling case your frequency response reference is the input Fs, and it's understood that frequencies beyond Fs/2 of the output rate will be attenuated and folded; so the f variable is relative to the input rate and can go from 0 to pi. In the up-sampling case, it's not possible to apply a frequency beyond Fs/2 of the INPUT rate, so in that case the f variable is referenced to the input rate and can go from 0 to pi. The sinc attenuation then applies to the images of the zero-stuffed input (only conceptual; again, the Hogenauer trick comes into play). In the interpolation case there is no folding, only images with finite attenuation. So I think some of the formulas you mentioned are for interpolation, and some for decimation. Bob

Reply by ●September 5, 20142014-09-05

On Wed, 03 Sep 2014 15:41:25 -0500, "kaz" <37480@dsprelated> wrote:>Hi All > >1) According to M.Donadio article "Cascaded Integrator-Comb Filter >Introduction" >Hf = (sin(pi*f*M)./sin(pi*f/R)).^N; > >where >Hf = amplitude response at frequency f >M = number of comb delay stages >N = number of cascaded comb/integrator pairs >R = rate change(up or down) > >2) According to Rick Lyon's article "Understanding cascaded >Integrator-comb" >Hf = (sin(pi*f*D)/sin(pi*f)).^M > >..D possibly is M and M possibly is N and R is invisible > >3) According to Xilinx article "CIC compiler" >Hf = (sin(pi*f*R*M)/sin(pi*f)).^N > >4) According to my confused matlab based work on all above formulas, none >of them makes sense. > >What am I missing? I know I can go to Z domain but I just want to sort this >equation out. > >Your help appreciated > >KazHello Kaz, In my article I failed to define my freq variable 'f'. (Shame on me.) My 'f' is a scalar value ranging from -0.5 -to- +0.5. (In terms of Hz, that freq variable range is -Fs/2 -to- +Fs/2 where Fs is the input data sample rate in Hz.) My 'D' is the length of a single comb filter. And my 'M' is the number of cascaded comb/integrator pairs. Try out the following Matlab code. When D = 8 and M = 1, the freq magnitude response peak value is D = 8. When M = 2, the freq magnitude response peak value is D^2 = 64. When M = 3, the freq magnitude response peak value is D^3 = 512. clear, clc f = -0.5:0.001:0.5; % Freq normalized to Fs Hz D = 8; % Length of comb delay line M = 1; % Number of cascaded stages Numer = sin(pi*f*D); Denom = sin(pi*f); Ratio = Numer./Denom; Ratio_Mag = (abs(Ratio)).^M; figure(1) plot(f, Ratio_Mag) grid on, zoom on Good Luck, [-Rick-]

Reply by ●September 5, 20142014-09-05

Thanks Bob and Rick. I came to the conclusion that the above formula in xilinx doc gives expected results for a decimator. However the docs I referred to do not specify R as being different between interpolating or decimating cases. I am still looking at this issue. Rick, do you mean if D = 1 then we get no filter but just unity pass through? How come that when many cic filters have D of 1 Regards Kaz _____________________________ Posted through www.DSPRelated.com

Reply by ●September 6, 20142014-09-06

On Fri, 05 Sep 2014 14:04:38 -0500, "kaz" <37480@dsprelated> wrote:>Thanks Bob and Rick. > >I came to the conclusion that the above formula in xilinx doc gives >expected results for a decimator. However the docs I referred to do not >specify R as being different between interpolating or decimating cases. I >am still looking at this issue. > >Rick, > >do you mean if D = 1 then we get no filter but just unity pass through?Hi, When I write D = 1, it means one delay element in the comb filter. When my D = 1, if the input to the comb filter is x(n) then the output of the comb filter is x(n) -x(n-1). My 'D" is Donadio's 'M'.>How come that when many cic filters have D of 1Well, I can't say for sure. If someone's comb filter has only one delay element it would be a rather poor-performance CIC filter. It would have a very wide main lobe and no sidelobes at all in the frequency domain. [-Rick-]

Reply by ●September 6, 20142014-09-06

>On Fri, 05 Sep 2014 14:04:38 -0500, "kaz" <37480@dsprelated> wrote: > >>Thanks Bob and Rick. >> >>I came to the conclusion that the above formula in xilinx doc gives >>expected results for a decimator. However the docs I referred to do not >>specify R as being different between interpolating or decimating cases.I>>am still looking at this issue. >> >>Rick, >> >>do you mean if D = 1 then we get no filter but just unity pass through? > >Hi, > When I write D = 1, it means one delay element in >the comb filter. When my D = 1, if the input to the >comb filter is x(n) then the output of the comb >filter is x(n) -x(n-1). > >My 'D" is Donadio's 'M'. > >>How come that when many cic filters have D of 1 > >Well, I can't say for sure. If someone's comb >filter has only one delay element it would be a >rather poor-performance CIC filter. It would have >a very wide main lobe and no sidelobes at all >in the frequency domain. > >[-Rick-] >Hi Rick, but if D = 1 you don't get any filter at all in our equation: sin(pi*f*1)/sin(pi*f) = 1 By the way why haven't included Rate value as Donadio? Kaz _____________________________ Posted through www.DSPRelated.com

Reply by ●September 7, 20142014-09-07

On Sat, 06 Sep 2014 12:55:01 -0500, "kaz" <37480@dsprelated> wrote:>>On Fri, 05 Sep 2014 14:04:38 -0500, "kaz" <37480@dsprelated> wrote: >> >>>Thanks Bob and Rick. >>> >>>I came to the conclusion that the above formula in xilinx doc gives >>>expected results for a decimator. However the docs I referred to do not >>>specify R as being different between interpolating or decimating cases. >I >>>am still looking at this issue. >>> >>>Rick, >>> >>>do you mean if D = 1 then we get no filter but just unity pass through? >> >>Hi, >> When I write D = 1, it means one delay element in >>the comb filter. When my D = 1, if the input to the >>comb filter is x(n) then the output of the comb >>filter is x(n) -x(n-1). >> >>My 'D" is Donadio's 'M'. >> >>>How come that when many cic filters have D of 1 >> >>Well, I can't say for sure. If someone's comb >>filter has only one delay element it would be a >>rather poor-performance CIC filter. It would have >>a very wide main lobe and no sidelobes at all >>in the frequency domain. >> >>[-Rick-] >> >Hi Rick,Hi Kaz,>but if D = 1 you don't get any filter at all in our equation: >sin(pi*f*1)/sin(pi*f) = 1Oh shoot, my mistake. *SORRY* I often get the number of delay elements in a moving average filter and its equivalent CIC filter mixed up. You're right. Having D = 1 would yield a filter having a unit impulse response and be "just unity pass through" as you put it. With D = 2, we'd have a rather poor-performance CIC filter. A CIC filter with a very wide main lobe and no sidelobes at all in the frequency domain. Sorry for the confusion Kaz.>By the way why haven't included Rate value as Donadio?I'm not sure what you're asking me here. You seem to say a "Rate value" is not included somewhere. Can you be more specific? [-Rick-]

Reply by ●September 8, 20142014-09-08