On Jul 23, 6:25�pm, vizziee <vizz...@gmail.com> wrote:
> On Jul 23, 11:55�am, vizziee <vizz...@gmail.com> wrote:
>
>
>
>
>
> > On Jul 9, 12:47�pm, Dirk Bell <bellda2...@cox.net> wrote:
>
> > > On Jul 8, 6:44�pm, vizziee <vizz...@gmail.com> wrote:
>
> > > > > Check your equations. �I get
>
> > > > > ( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) = 102.4750
> > > > > which is consistant with what you are actually getting, not what you
> > > > > are calculating.
>
> > > > > Also note that the filters you are identifying as half-band filters
> > > > > are not actually half-band filters. �Half-band filters have the
> > > > > property that almost half of the coefficients are zero, saving
> > > > > calculations, which may be useful to you. But, among other properties,
> > > > > the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
> > > > > 23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
> > > > > band filter.
>
> > > > > Dirk Bell
>
> > > > Thanks Dirk. I checked the Halfband filters that I generated in
> > > > MATLAB. It says it has Direct Form Polyphase Filter structure. The
> > > > coefficients were generated by specifying 'halfband' option to
> > > > fdesign.decimator function. The number of generated coefficients for
> > > > this half-band decimator is actually 21 and I padded a zero to make it
> > > > 22 for a 2-path polyphase implementation.
>
> > > > I did a reading for Half-band filters and what you say about the
> > > > HalfBand FIR filter coefficients is absolutely true: the number of
> > > > coefficients should be 3+4n for a non-negative integer n. However I
> > > > couldn't reconcile the MATLAB halfband filter generated above with
> > > > this definition. Are halfband decimators different than the Nyquist
> > > > half-band filters? Also the way you calculated the delay of half-band
> > > > filters appears very much true. However assuming this is the polyphase
> > > > implementation of half-band decimators, shouldn't delay be calculated
> > > > like a standard polyphase filter delay formula: ((No_of_taps-1)/2)/
> > > > Decimation_Factor?
>
> > > > Thanks again for your insightful replies earlier. I could drastically
> > > > reduce the no of taps in my current design while also bettering the
> > > > response. Though the questions as above still linger in my mind.
>
> > > > Regards,
>
> > > > vizziee.
>
> > > Vizziee,
>
> > > Would you post the coefficients (or preferably all MATLAB inputs and
> > > resulting output) from your halfband design.
>
> > > BTW a halfband filter could have a length 21 if it is really a length
> > > 19 filter with a zero added to each end, but that would be a waste of
> > > computation if you used the zero coefficients.
>
> > > Dirk Bell
> > > DSP Consultant
>
> > Thanks Dirk. After a little bit of reading and experimenting, it
> > appears to me that the MATLAB coefficients so generated for a Halfband
> > filter were because of the fact that they were implemented as
> > polyphase structure. The coefficients and the command use dto generate
> > them are as follows:
>
> > dhb = fdesign.decimator(2, 'halfband', 'N,AST', 20, 80, 200e6);
> > hb = design(dhb);
> > hb.Numerator =
> > 0 � �0.0015 � � � � 0 � -0.0083 � � � � 0 � �0.0283 � � � � 0
> > -0.0801 � � � � 0 � �0.3087 � �0.5000 � �0.3087 � � � � 0
> > -0.0801 � � � � 0 � �0.0283 � � � � 0 � �-0.0083 � � � � 0
> > 0.0015 � � � � 0
>
> > Regards,
> > vizziee.
>
> I gather that since I specified the order of this half-band filter, it
> is bound to have 21 coefficients. The condition N = 3q+1 where N =
> order of the filter and q a non-neg integer for half-band filters is
> only applicable when one designs it for "minimum order".
>
> Regards,
>
> vizziee.- Hide quoted text -
>
> - Show quoted text -
Vizzee,
You have a newer version of MATLAB than I do, so I do not know what
all of the implications are of the MATLAB code you posted. nor exactly
how you are going to use the result. Here are a couple of comments
you can read and forget if they are not relevant to what you are
doing.
If you are using this as a polyphase filter implemented as two equal
length filters then you would drop the leading 0 coefficient. When you
then put alternate coefficients into the two filters, one will be all
nonzero taps, and the other will be all zeros except for the 0.5
term. If you implement this using a generic decimate by two polyphase
implementation then the second section will do a lot of multiplies by
zero. This negates the main advantage of using a halfband filter,
which is not multiplying by zero coefficients.
So if you are interested in multiplier efficiency, a general purpose
polyphase filter implementation should not be used for a decimating
halfband filter. There might be a more efficient implementation
script in the newer MATLAB or you could write your own.
Dirk Bell
DSP Consultant
Reply by vizziee●July 23, 20092009-07-23
On Jul 23, 11:55�am, vizziee <vizz...@gmail.com> wrote:
> On Jul 9, 12:47�pm, Dirk Bell <bellda2...@cox.net> wrote:
>
>
>
> > On Jul 8, 6:44�pm, vizziee <vizz...@gmail.com> wrote:
>
> > > > Check your equations. �I get
>
> > > > ( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) = 102.4750
> > > > which is consistant with what you are actually getting, not what you
> > > > are calculating.
>
> > > > Also note that the filters you are identifying as half-band filters
> > > > are not actually half-band filters. �Half-band filters have the
> > > > property that almost half of the coefficients are zero, saving
> > > > calculations, which may be useful to you. But, among other properties,
> > > > the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
> > > > 23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
> > > > band filter.
>
> > > > Dirk Bell
>
> > > Thanks Dirk. I checked the Halfband filters that I generated in
> > > MATLAB. It says it has Direct Form Polyphase Filter structure. The
> > > coefficients were generated by specifying 'halfband' option to
> > > fdesign.decimator function. The number of generated coefficients for
> > > this half-band decimator is actually 21 and I padded a zero to make it
> > > 22 for a 2-path polyphase implementation.
>
> > > I did a reading for Half-band filters and what you say about the
> > > HalfBand FIR filter coefficients is absolutely true: the number of
> > > coefficients should be 3+4n for a non-negative integer n. However I
> > > couldn't reconcile the MATLAB halfband filter generated above with
> > > this definition. Are halfband decimators different than the Nyquist
> > > half-band filters? Also the way you calculated the delay of half-band
> > > filters appears very much true. However assuming this is the polyphase
> > > implementation of half-band decimators, shouldn't delay be calculated
> > > like a standard polyphase filter delay formula: ((No_of_taps-1)/2)/
> > > Decimation_Factor?
>
> > > Thanks again for your insightful replies earlier. I could drastically
> > > reduce the no of taps in my current design while also bettering the
> > > response. Though the questions as above still linger in my mind.
>
> > > Regards,
>
> > > vizziee.
>
> > Vizziee,
>
> > Would you post the coefficients (or preferably all MATLAB inputs and
> > resulting output) from your halfband design.
>
> > BTW a halfband filter could have a length 21 if it is really a length
> > 19 filter with a zero added to each end, but that would be a waste of
> > computation if you used the zero coefficients.
>
> > Dirk Bell
> > DSP Consultant
>
> Thanks Dirk. After a little bit of reading and experimenting, it
> appears to me that the MATLAB coefficients so generated for a Halfband
> filter were because of the fact that they were implemented as
> polyphase structure. The coefficients and the command use dto generate
> them are as follows:
>
> dhb = fdesign.decimator(2, 'halfband', 'N,AST', 20, 80, 200e6);
> hb = design(dhb);
> hb.Numerator =
> 0 � �0.0015 � � � � 0 � -0.0083 � � � � 0 � �0.0283 � � � � 0
> -0.0801 � � � � 0 � �0.3087 � �0.5000 � �0.3087 � � � � 0
> -0.0801 � � � � 0 � �0.0283 � � � � 0 � �-0.0083 � � � � 0
> 0.0015 � � � � 0
>
> Regards,
> vizziee.
I gather that since I specified the order of this half-band filter, it
is bound to have 21 coefficients. The condition N = 3q+1 where N =
order of the filter and q a non-neg integer for half-band filters is
only applicable when one designs it for "minimum order".
Regards,
vizziee.
Reply by vizziee●July 23, 20092009-07-23
On Jul 9, 12:47�pm, Dirk Bell <bellda2...@cox.net> wrote:
> On Jul 8, 6:44�pm, vizziee <vizz...@gmail.com> wrote:
>
>
>
> > > Check your equations. �I get
>
> > > ( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) = 102.4750
> > > which is consistant with what you are actually getting, not what you
> > > are calculating.
>
> > > Also note that the filters you are identifying as half-band filters
> > > are not actually half-band filters. �Half-band filters have the
> > > property that almost half of the coefficients are zero, saving
> > > calculations, which may be useful to you. But, among other properties,
> > > the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
> > > 23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
> > > band filter.
>
> > > Dirk Bell
>
> > Thanks Dirk. I checked the Halfband filters that I generated in
> > MATLAB. It says it has Direct Form Polyphase Filter structure. The
> > coefficients were generated by specifying 'halfband' option to
> > fdesign.decimator function. The number of generated coefficients for
> > this half-band decimator is actually 21 and I padded a zero to make it
> > 22 for a 2-path polyphase implementation.
>
> > I did a reading for Half-band filters and what you say about the
> > HalfBand FIR filter coefficients is absolutely true: the number of
> > coefficients should be 3+4n for a non-negative integer n. However I
> > couldn't reconcile the MATLAB halfband filter generated above with
> > this definition. Are halfband decimators different than the Nyquist
> > half-band filters? Also the way you calculated the delay of half-band
> > filters appears very much true. However assuming this is the polyphase
> > implementation of half-band decimators, shouldn't delay be calculated
> > like a standard polyphase filter delay formula: ((No_of_taps-1)/2)/
> > Decimation_Factor?
>
> > Thanks again for your insightful replies earlier. I could drastically
> > reduce the no of taps in my current design while also bettering the
> > response. Though the questions as above still linger in my mind.
>
> > Regards,
>
> > vizziee.
>
> Vizziee,
>
> Would you post the coefficients (or preferably all MATLAB inputs and
> resulting output) from your halfband design.
>
> BTW a halfband filter could have a length 21 if it is really a length
> 19 filter with a zero added to each end, but that would be a waste of
> computation if you used the zero coefficients.
>
> Dirk Bell
> DSP Consultant
Thanks Dirk. After a little bit of reading and experimenting, it
appears to me that the MATLAB coefficients so generated for a Halfband
filter were because of the fact that they were implemented as
polyphase structure. The coefficients and the command use dto generate
them are as follows:
dhb = fdesign.decimator(2, 'halfband', 'N,AST', 20, 80, 200e6);
hb = design(dhb);
hb.Numerator =
0 0.0015 0 -0.0083 0 0.0283 0
-0.0801 0 0.3087 0.5000 0.3087 0
-0.0801 0 0.0283 0 -0.0083 0
0.0015 0
Regards,
vizziee.
Reply by Dirk Bell●July 9, 20092009-07-09
On Jul 8, 6:44�pm, vizziee <vizz...@gmail.com> wrote:
> > Check your equations. �I get
>
> > ( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) = 102.4750
> > which is consistant with what you are actually getting, not what you
> > are calculating.
>
> > Also note that the filters you are identifying as half-band filters
> > are not actually half-band filters. �Half-band filters have the
> > property that almost half of the coefficients are zero, saving
> > calculations, which may be useful to you. But, among other properties,
> > the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
> > 23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
> > band filter.
>
> > Dirk Bell
>
> Thanks Dirk. I checked the Halfband filters that I generated in
> MATLAB. It says it has Direct Form Polyphase Filter structure. The
> coefficients were generated by specifying 'halfband' option to
> fdesign.decimator function. The number of generated coefficients for
> this half-band decimator is actually 21 and I padded a zero to make it
> 22 for a 2-path polyphase implementation.
>
> I did a reading for Half-band filters and what you say about the
> HalfBand FIR filter coefficients is absolutely true: the number of
> coefficients should be 3+4n for a non-negative integer n. However I
> couldn't reconcile the MATLAB halfband filter generated above with
> this definition. Are halfband decimators different than the Nyquist
> half-band filters? Also the way you calculated the delay of half-band
> filters appears very much true. However assuming this is the polyphase
> implementation of half-band decimators, shouldn't delay be calculated
> like a standard polyphase filter delay formula: ((No_of_taps-1)/2)/
> Decimation_Factor?
>
> Thanks again for your insightful replies earlier. I could drastically
> reduce the no of taps in my current design while also bettering the
> response. Though the questions as above still linger in my mind.
>
> Regards,
>
> vizziee.
Vizziee,
Would you post the coefficients (or preferably all MATLAB inputs and
resulting output) from your halfband design.
BTW a halfband filter could have a length 21 if it is really a length
19 filter with a zero added to each end, but that would be a waste of
computation if you used the zero coefficients.
Dirk Bell
DSP Consultant
Reply by vizziee●July 8, 20092009-07-08
> Check your equations. =A0I get
>
> ( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) =3D 102.4750
> which is consistant with what you are actually getting, not what you
> are calculating.
>
> Also note that the filters you are identifying as half-band filters
> are not actually half-band filters. =A0Half-band filters have the
> property that almost half of the coefficients are zero, saving
> calculations, which may be useful to you. But, among other properties,
> the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
> 23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
> band filter.
>
> Dirk Bell
Thanks Dirk. I checked the Halfband filters that I generated in
MATLAB. It says it has Direct Form Polyphase Filter structure. The
coefficients were generated by specifying 'halfband' option to
fdesign.decimator function. The number of generated coefficients for
this half-band decimator is actually 21 and I padded a zero to make it
22 for a 2-path polyphase implementation.
I did a reading for Half-band filters and what you say about the
HalfBand FIR filter coefficients is absolutely true: the number of
coefficients should be 3+4n for a non-negative integer n. However I
couldn't reconcile the MATLAB halfband filter generated above with
this definition. Are halfband decimators different than the Nyquist
half-band filters? Also the way you calculated the delay of half-band
filters appears very much true. However assuming this is the polyphase
implementation of half-band decimators, shouldn't delay be calculated
like a standard polyphase filter delay formula: ((No_of_taps-1)/2)/
Decimation_Factor?
Thanks again for your insightful replies earlier. I could drastically
reduce the no of taps in my current design while also bettering the
response. Though the questions as above still linger in my mind.
Regards,
vizziee.
Reply by Dirk Bell●July 7, 20092009-07-07
On Jul 7, 2:49�pm, vizziee <vizz...@gmail.com> wrote:
> > You should check out using multistage decimation if you want to
> > decimate by 20. �A halfband decimating filter, another halfband
> > decimating filter, then a decimate by 5 filter. �In the first two
> > stages, in order to cut down the number of taps, don't preserve (alias
> > free) any bandwidth you don't need. �Design the final filter as a
> > cleanup to remove aliasing from the 1st 2 filters and do bandlimiting
> > for the final decimation. �This is standard practice.
>
> > Dirk Bell
>
> Thanks Dirk. I tried this design and the number of taps vis-a-vis
> number of polyphase filters got reduced by 4 (discounting the number
> of taps in Half-band filters). This is a great savings as. earlier.
> for the same roll-off I had 200taps for some 20 filters in the
> polyphase structure.
>
> However, my calculations for the processing delay don't match up with
> my results in the MATLAB:
> No of taps in the first (Direct Form Polyphase) Half-band filter = N1
> = 22
> Processing delay at the output of first Half-band filter = D1 = ceil
> (((N1/2) - 1)/2) = 5
> No of taps in the first (Direct Form Polyphase) Half-band filter = N2
> = 22
> Processing delay at the output of first Half-band filter = D2 =ceil
> ( ((N2/2) - 1)/2) = 5
> No of taps in the first (Direct Form Polyphase) Decimate-by-5 filter =
> N3 = 1010
> Processing delay in Polyphase (decimate by 5) filter = D3 = ceil
> (((N3/5) - 1)/2) = 101
>
> Total delay = sum(D1, D2, D3) = 5+5+101 = 111 samples
>
> However my output only shows a delay of 102 samples after the last
> filter stage.
>
> Regards,
>
> vizziee.
Vizzee,
Check your equations. I get
( ( (22-1)/2 )/20 + ( (22-1)/2 )/10 + ( (1010-1)/2 )/5 ) = 102.4750
which is consistant with what you are actually getting, not what you
are calculating.
Also note that the filters you are identifying as half-band filters
are not actually half-band filters. Half-band filters have the
property that almost half of the coefficients are zero, saving
calculations, which may be useful to you. But, among other properties,
the lengths of halfband filters are constrained to {3, 7, 11, 15, 19,
23, 27, ..., previous+4, ...}, so a filter of length 22 isn't a half-
band filter.
Dirk Bell
Reply by vizziee●July 7, 20092009-07-07
> functionality in a FPGA. The graychip functionality provides a CIC
> filter �followed by 2 stages of decimation. The CIC provides a simple
> but effective decimation mechanism �- the next filter also performs
> decimation but it is also meant to compensate for the droop of the
> passband in the CIC filter. To understand how to design the multistage
> decimation filters I would recommend reading Crochiere and Rabiner's
> (Multirate Signal Processing) - I'm not sure if I've got that
> reference exactly right.
Thanks David. But as I wrote before, I am not satisfied with the
response of CIC-Compensator-HalfBand filter. One of the primary
reasons for this is I have three frequency channels to filter and the
response of CIC-et.al. filter allows some leakage of the adjacent
channels to the output. This is not a problem with the polyphase LPF
implementation.
Regards,
vizziee.
Reply by vizziee●July 7, 20092009-07-07
> You should check out using multistage decimation if you want to
> decimate by 20. �A halfband decimating filter, another halfband
> decimating filter, then a decimate by 5 filter. �In the first two
> stages, in order to cut down the number of taps, don't preserve (alias
> free) any bandwidth you don't need. �Design the final filter as a
> cleanup to remove aliasing from the 1st 2 filters and do bandlimiting
> for the final decimation. �This is standard practice.
>
> Dirk Bell
Thanks Dirk. I tried this design and the number of taps vis-a-vis
number of polyphase filters got reduced by 4 (discounting the number
of taps in Half-band filters). This is a great savings as. earlier.
for the same roll-off I had 200taps for some 20 filters in the
polyphase structure.
However, my calculations for the processing delay don't match up with
my results in the MATLAB:
No of taps in the first (Direct Form Polyphase) Half-band filter = N1
= 22
Processing delay at the output of first Half-band filter = D1 = ceil
(((N1/2) - 1)/2) = 5
No of taps in the first (Direct Form Polyphase) Half-band filter = N2
= 22
Processing delay at the output of first Half-band filter = D2 =ceil
( ((N2/2) - 1)/2) = 5
No of taps in the first (Direct Form Polyphase) Decimate-by-5 filter =
N3 = 1010
Processing delay in Polyphase (decimate by 5) filter = D3 = ceil
(((N3/5) - 1)/2) = 101
Total delay = sum(D1, D2, D3) = 5+5+101 = 111 samples
However my output only shows a delay of 102 samples after the last
filter stage.
Regards,
vizziee.
Reply by Dave●July 7, 20092009-07-07
On Jul 6, 8:26�pm, Dirk Bell <bellda2...@cox.net> wrote:
> On Jul 6, 1:51�pm, vizziee <vizz...@gmail.com> wrote:
>
> > > be ceil(1005/M1) = 50 and so I would have M1=20 such filters. Would
>
> > A correction here: �ceil(1005/M1) = 51.
>
> > Regards,
> > vizziee.
>
You could use a graychip directly instead of reimplementing that
functionality in a FPGA. The graychip functionality provides a CIC
filter followed by 2 stages of decimation. The CIC provides a simple
but effective decimation mechanism - the next filter also performs
decimation but it is also meant to compensate for the droop of the
passband in the CIC filter. To understand how to design the multistage
decimation filters I would recommend reading Crochiere and Rabiner's
(Multirate Signal Processing) - I'm not sure if I've got that
reference exactly right.
Cheers,
David
> Vizzie,
>
> You should check out using multistage decimation if you want to
> decimate by 20. �A halfband decimating filter, another halfband
> decimating filter, then a decimate by 5 filter. �In the first two
> stages, in order to cut down the number of taps, don't preserve (alias
> free) any bandwidth you don't need. �Design the final filter as a
> cleanup to remove aliasing from the 1st 2 filters and do bandlimiting
> for the final decimation. �This is standard practice.
>
> This is also NOT a detailed description of how to design these
> filters.
>
> Dirk Bell
Reply by Dirk Bell●July 6, 20092009-07-06
On Jul 6, 1:51�pm, vizziee <vizz...@gmail.com> wrote:
> > be ceil(1005/M1) = 50 and so I would have M1=20 such filters. Would
>
> A correction here: �ceil(1005/M1) = 51.
>
> Regards,
> vizziee.
Vizzie,
You should check out using multistage decimation if you want to
decimate by 20. A halfband decimating filter, another halfband
decimating filter, then a decimate by 5 filter. In the first two
stages, in order to cut down the number of taps, don't preserve (alias
free) any bandwidth you don't need. Design the final filter as a
cleanup to remove aliasing from the 1st 2 filters and do bandlimiting
for the final decimation. This is standard practice.
This is also NOT a detailed description of how to design these
filters.
Dirk Bell