Hello...I created a polyphase decimating filter based on F.Harris's book shared register design. This is a Decimation by 2, 100 tap, Fs =100MHz, Low pass 20MHz - stop band 24MHz filter. Each MAC is 28-bit length, 14-bit ADC input, and the filter output is truncated. The filter looks good at first, starts attenuating at 20MHz, and then cuts off about 23MHz.. but when I keep increasing frequency for example to 30Mhz, signal gets introduced back in. I see this in simulation and the lab. On-board there is a pre-filter 3db at 50MHz but of course that doesn't help me since the 30Mhz is allowable. Can any one give me a clue why this is happening?? I have scaled the quantized filter coefficients to 0.9 calculated by Matlab... I tried rounding and clamping but the output was garbage... Thanks so much. Tamara...

# Polyphase decimating filter - not working - why?

Started by ●February 1, 2007

Reply by ●February 1, 20072007-02-01

"Tamara" <thall@naic.edu> writes:> Hello...I created a polyphase decimating filter based on F.Harris's book > shared register design. This is a Decimation by 2, 100 tap, Fs =100MHz, > Low pass 20MHz - stop band 24MHz filter. Each MAC is 28-bit length, > 14-bit ADC input, and the filter output is truncated. > > The filter looks good at first, starts attenuating at 20MHz, and then cuts > off about 23MHz.. but when I keep increasing frequency for example to > 30Mhz, signal gets introduced back in.How much of the signal? Is it 60 dB down? That may be normal depending on the stop-band lobes of your filter.> I see this in simulation and the > lab. On-board there is a pre-filter 3db at 50MHz but of course that > doesn't help me since the 30Mhz is allowable. > > Can any one give me a clue why this is happening?? I have scaled the > quantized filter coefficients to 0.9 calculated by Matlab... I tried > rounding and clamping but the output was garbage...Post your coefficients and we'll have a look. -- % Randy Yates % "Remember the good old 1980's, when %% Fuquay-Varina, NC % things were so uncomplicated?" %%% 919-577-9882 % 'Ticket To The Moon' %%%% <yates@ieee.org> % *Time*, Electric Light Orchestra http://home.earthlink.net/~yatescr

Reply by ●February 1, 20072007-02-01

Hi Randy.. Thanks for your response... Well the signal level I see on the spectrum analyzer is slowely increasing after 24MHz. An input of 35MHz/9dBm the output filter is at a level of 7 DBm @ 17MHz. Somehow I'm getting a kind of wrap around. Here are my filter coeff - I'm pretty sure they are Ok because I implementing the Xilinx core using the same coefficients to compare. Here's the matlab code I used.. [n,fo,mo,w] = firpmord([20 23],[1 0],[.00004 .1],100); h=remez(n,fo,mo); h = h(:); w = blackmanharris(n+1); hh = h.*w; scale = hh/max(hh); scale = scale*0.90; Here are the actual coefficients... -1,-1,0,0,0,-1,-1,0,0,-1,-1,-1,1,1,-3,-4,1,7,1,-13,-10,15,23,-12,-44, -6,62,40,-71,-97,51,164,12,-225,-134, 245,313,-183,-539,-21,779,455, -996,-1395,1145,5307,7371,5307,1145,-1395,-996,455,779,-21,539,183,313, 245,-134,-225,12,164,51,-97,-71,40,62,-6,-44,-12,23,15,-10,-13,1,7,1,-4, -3,1,1,-1,-1,-1,0,0,-1,-1,0,0,0,-1,-1,0>"Tamara" <thall@naic.edu> writes: > >> Hello...I created a polyphase decimating filter based on F.Harris'sbook>> shared register design. This is a Decimation by 2, 100 tap, Fs=100MHz,>> Low pass 20MHz - stop band 24MHz filter. Each MAC is 28-bit length, >> 14-bit ADC input, and the filter output is truncated. >> >> The filter looks good at first, starts attenuating at 20MHz, and thencuts>> off about 23MHz.. but when I keep increasing frequency for example to >> 30Mhz, signal gets introduced back in. > >How much of the signal? Is it 60 dB down? That may be normal depending >on the stop-band lobes of your filter. > >> I see this in simulation and the >> lab. On-board there is a pre-filter 3db at 50MHz but of course that >> doesn't help me since the 30Mhz is allowable. >> >> Can any one give me a clue why this is happening?? I have scaled the >> quantized filter coefficients to 0.9 calculated by Matlab... I tried >> rounding and clamping but the output was garbage... > >Post your coefficients and we'll have a look. >-- >% Randy Yates % "Remember the good old 1980's, when >%% Fuquay-Varina, NC % things were so uncomplicated?" >%%% 919-577-9882 % 'Ticket To The Moon' >%%%% <yates@ieee.org> % *Time*, Electric Light Orchestra >http://home.earthlink.net/~yatescr >

Reply by ●February 1, 20072007-02-01

"Tamara" <thall@naic.edu> writes:> Hi Randy.. Thanks for your response... > > Well the signal level I see on the spectrum analyzer is slowely increasing > after 24MHz. An input of 35MHz/9dBm the output filter is at a level of 7 > DBm @ 17MHz. Somehow I'm getting a kind of wrap around. > > Here are my filter coeff - I'm pretty sure they are Ok because I > implementing the Xilinx core using the same coefficients to compare. > > Here's the matlab code I used.. > > [n,fo,mo,w] = firpmord([20 23],[1 0],[.00004 .1],100); > h=remez(n,fo,mo); > h = h(:); > w = blackmanharris(n+1); > hh = h.*w; > scale = hh/max(hh); > scale = scale*0.90; > > Here are the actual coefficients... > > -1,-1,0,0,0,-1,-1,0,0,-1,-1,-1,1,1,-3,-4,1,7,1,-13,-10,15,23,-12,-44, > -6,62,40,-71,-97,51,164,12,-225,-134, 245,313,-183,-539,-21,779,455, > -996,-1395,1145,5307,7371,5307,1145,-1395,-996,455,779,-21,539,183,313, > 245,-134,-225,12,164,51,-97,-71,40,62,-6,-44,-12,23,15,-10,-13,1,7,1,-4, > -3,1,1,-1,-1,-1,0,0,-1,-1,0,0,0,-1,-1,0Hi Tamara, I can see you have one definite problem and two potential others. You're only getting about 25 dB stop-band attenuation out of that filter. It's really quite a horrible filter because of this and the amount of in-band ripple, unless you designed it that way for some reason. There is no reason to window your filter coefficients with any window. That is, the "h" right out of remez() is your final coefficient vector (sans scaling). My Matlab doesn't have firpmord() so I can't run your script, but I don't see how it would produce the coefficients you gave since the normalization stage of hh/max(hh) should result in coefficients that are less than or equal to one. The further scaling by 0.9 should make them strictly less than one. I would try removing the window first to see how that improves your response, then try it again. --Randy PS: If the maximum magnitude in h.*w happened to be negative, your scaling operation of hh/max(hh) won't work right. It should be hh/max(abs(hh)).> > > >>"Tamara" <thall@naic.edu> writes: >> >>> Hello...I created a polyphase decimating filter based on F.Harris's > book >>> shared register design. This is a Decimation by 2, 100 tap, Fs > =100MHz, >>> Low pass 20MHz - stop band 24MHz filter. Each MAC is 28-bit length, >>> 14-bit ADC input, and the filter output is truncated. >>> >>> The filter looks good at first, starts attenuating at 20MHz, and then > cuts >>> off about 23MHz.. but when I keep increasing frequency for example to >>> 30Mhz, signal gets introduced back in. >> >>How much of the signal? Is it 60 dB down? That may be normal depending >>on the stop-band lobes of your filter. >> >>> I see this in simulation and the >>> lab. On-board there is a pre-filter 3db at 50MHz but of course that >>> doesn't help me since the 30Mhz is allowable. >>> >>> Can any one give me a clue why this is happening?? I have scaled the >>> quantized filter coefficients to 0.9 calculated by Matlab... I tried >>> rounding and clamping but the output was garbage... >> >>Post your coefficients and we'll have a look. >>-- >>% Randy Yates % "Remember the good old 1980's, when >>%% Fuquay-Varina, NC % things were so uncomplicated?" >>%%% 919-577-9882 % 'Ticket To The Moon' >>%%%% <yates@ieee.org> % *Time*, Electric Light Orchestra >>http://home.earthlink.net/~yatescr >> > >-- % Randy Yates % "The dreamer, the unwoken fool - %% Fuquay-Varina, NC % in dreams, no pain will kiss the brow..." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Eldorado Overture', *Eldorado*, ELO http://home.earthlink.net/~yatescr

Reply by ●February 1, 20072007-02-01

On Thu, 01 Feb 2007 22:03:29 -0000, Tamara <thall@naic.edu> wrote:> Hi Randy.. Thanks for your response... > > Well the signal level I see on the spectrum analyzer is slowely => increasing > after 24MHz. An input of 35MHz/9dBm the output filter is at a level o=f 7> DBm @ 17MHz. Somehow I'm getting a kind of wrap around. > > Here are my filter coeff - I'm pretty sure they are Ok because I > implementing the Xilinx core using the same coefficients to compare. > > Here's the matlab code I used.. > > [n,fo,mo,w] =3D firpmord([20 23],[1 0],[.00004 .1],100); > h=3Dremez(n,fo,mo); > h =3D h(:); > w =3D blackmanharris(n+1); > hh =3D h.*w; > scale =3D hh/max(hh); > scale =3D scale*0.90; > > Here are the actual coefficients... > > -1,-1,0,0,0,-1,-1,0,0,-1,-1,-1,1,1,-3,-4,1,7,1,-13,-10,15,23,-12,-44, > -6,62,40,-71,-97,51,164,12,-225,-134, 245,313,-183,-539,-21,779,455, > -996,-1395,1145,5307,7371,5307,1145,-1395,-996,455,779,-21,539,183,313=,> 245,-134,-225,12,164,51,-97,-71,40,62,-6,-44,-12,23,15,-10,-13,1,7,1,-=4,> -3,1,1,-1,-1,-1,0,0,-1,-1,0,0,0,-1,-1,0Hmm, I think there's a mistake somewhere. If you put the above = coefficients in an array, c, then do the following code: cla hold on stem(scale, 'b') stem(circshift(c, [0 1]) * max(scale) / max(c), 'r') you'll see they don't match quite significantly. -- = Oli

Reply by ●February 2, 20072007-02-02

>On Thu, 01 Feb 2007 22:03:29 -0000, Tamara <thall@naic.edu> wrote: > >> Hi Randy.. Thanks for your response... >> >> Well the signal level I see on the spectrum analyzer is slowely = > >> increasing >> after 24MHz. An input of 35MHz/9dBm the output filter is at a levelo=>f 7 >> DBm @ 17MHz. Somehow I'm getting a kind of wrap around. >> >> Here are my filter coeff - I'm pretty sure they are Ok because I >> implementing the Xilinx core using the same coefficients to compare. >> >> Here's the matlab code I used.. >> >> [n,fo,mo,w] =3D firpmord([20 23],[1 0],[.00004 .1],100); >> h=3Dremez(n,fo,mo); >> h =3D h(:); >> w =3D blackmanharris(n+1); >> hh =3D h.*w; >> scale =3D hh/max(hh); >> scale =3D scale*0.90; >> >> Here are the actual coefficients... >> >> -1,-1,0,0,0,-1,-1,0,0,-1,-1,-1,1,1,-3,-4,1,7,1,-13,-10,15,23,-12,-44, >> -6,62,40,-71,-97,51,164,12,-225,-134, 245,313,-183,-539,-21,779,455, >>-996,-1395,1145,5307,7371,5307,1145,-1395,-996,455,779,-21,539,183,313=>, >>245,-134,-225,12,164,51,-97,-71,40,62,-6,-44,-12,23,15,-10,-13,1,7,1,-=>4, >> -3,1,1,-1,-1,-1,0,0,-1,-1,0,0,0,-1,-1,0 > >Hmm, I think there's a mistake somewhere. If you put the above = > >coefficients in an array, c, then do the following code: > > cla > hold on > stem(scale, 'b') > stem(circshift(c, [0 1]) * max(scale) / max(c), 'r') > >you'll see they don't match quite significantly. > > > >-- = > >Oli >hi , i think there is a better way in calculating the filter taps 1. use remezord to calculate the order of the filter rather than firpmord and in the remezord mention the pass band attenuation and the stopband ripple properly 2. use the order returned by "remezord" function to calculate the coefficients using "remez" function 3. no need to window the coefficients that come as output from step 2 4. i dont think u need to do scaling also (not sure....) regards, srikanth konjeti

Reply by ●February 2, 20072007-02-02

srikk wrote: ...> 3. no need to window the coefficients that come as output from step 2Windowing is for theoretical filters like truncated sync. For the empirically optimized coefficients that remez() provides, it is harmful. Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Reply by ●February 5, 20072007-02-05

Hello. I have used all this valuable feedback, tested and I still have the same problem.... I'm curious to know why everyone suggests not to window - I'm windowing with Blackman to minimize passband ripple, have better stop-band attenuation and group delay. Here is my Matlab code.. [n,fo,mo,w] = remezord([20 23.2],[1 0],[.00001 .1],100); h=remez(n,fo,mo); b = 14; h = h(:); scale1 = h/max(abs(h)); scale1 = scale*0.90; h_quant = floor(scale1*((2^(b-1))-1)); h_quant = h_quant(:); freqz(h_quant) figure w = blackmanharris(n+1); hh = h.*w; scale2 = hh/max(abs(hh)); scale2 = scale2*0.90; h1_quant = floor(scale2*((2^(b-1))-1)); h1_quant = h1_quant(:); subplot(2,1,2); freqz(h1_quant)

Reply by ●February 6, 20072007-02-06

"Tamara" <thall@naic.edu> writes:> Hello. I have used all this valuable feedback, tested and I still have the > same problem.... I'm curious to know why everyone suggests not to window - > I'm windowing with Blackman to minimize passband ripple, have better > stop-band attenuation and group delay.Hi Tamara, Who told you that windowing improves these things? It actually degrades rather than improves them. To illustrate using a simple example, consider a perfect brick-wall filter h(t) which has a rectangular frequency-domain response H(f). Windowing (multiplying) h(t) in time with a window w(t) is equivalent to convolving H(f) with W(f), where W(f) is the frequency response of the window. Since H(f) was rectangular, its passband was perfect to begin with. When you convolve the frequency domain response with W(f), you only degrade the passband ripple, and you bring up the noise floor. You still have the windowing in - take it out and see what you get. --Randy Here is my Matlab code..> > [n,fo,mo,w] = remezord([20 23.2],[1 0],[.00001 .1],100); > h=remez(n,fo,mo); > b = 14; > h = h(:); > scale1 = h/max(abs(h)); > scale1 = scale*0.90; > h_quant = floor(scale1*((2^(b-1))-1)); > h_quant = h_quant(:); > freqz(h_quant) > figure > w = blackmanharris(n+1); > hh = h.*w; > scale2 = hh/max(abs(hh)); > scale2 = scale2*0.90; > h1_quant = floor(scale2*((2^(b-1))-1)); > h1_quant = h1_quant(:); > subplot(2,1,2); > freqz(h1_quant) > > > > >-- % Randy Yates % "Bird, on the wing, %% Fuquay-Varina, NC % goes floating by %%% 919-577-9882 % but there's a teardrop in his eye..." %%%% <yates@ieee.org> % 'One Summer Dream', *Face The Music*, ELO http://home.earthlink.net/~yatescr

Reply by ●February 6, 20072007-02-06

On Feb 5, 9:01 pm, Randy Yates <y...@ieee.org> wrote:> "Tamara" <t...@naic.edu> writes: > > Hello. I have used all this valuable feedback, tested and I still have the > > same problem.... I'm curious to know why everyone suggests not to window - > > I'm windowing with Blackman to minimize passband ripple, have better > > stop-band attenuation and group delay. > > Hi Tamara, > > Who told you that windowing improves these things? It actually >> degrades rather than improves them. > > To illustrate using a simple example, consider a perfect brick-wall > filter h(t) which has a rectangular frequency-domain response > H(f).A brick wall filter rectangular in frequency domain response H(f) is a sinc of -infinite- extent in the time domain.>Since H(t) is a sincWindowing (multiplying) h(t) in time with a window w(t) is > equivalent to convolving H(f) with W(f), where W(f) is the frequency > response of the window. Since H(f) was rectangular, its passband was > perfect to begin with.Since you had to choose a finite region of the sinc for a actual implementation, An actual H(f) has ringing on both sides of the finite transition bands.> When you convolve the frequency domain response > with W(f), you only degrade the passband ripple, and you bring up > the noise floor.A windowed sync will degrade the ripple and allow tradeoff between transition band width and noise floor suppression.> > You still have the windowing in - take it out and see what you get. > > --Randy >So Tamara, 1) Use a sinc instead of remez waveform if you choose to create windowed filter coefficients. 2) Apply a window to the sync to control/tradeoff ringing and transition band. (not applying a window to a truncated sync is called the rectangular window). 3) If you decide to implement a windowed filter Google 'windowed FIR filter design' for more information. 4) If you use a good remez designed filter you do not need a windowed filter design. Good luck! Dale B. Dalrymple http:dbdimages.com