Reply by Mark Borgerding●September 14, 20052005-09-14
Fred Marshall wrote:
> "jaan" <jants.sepp@solo.delfi.ee> wrote in message
> news:gpCdnZ2dnZ1REL7UnZ2dnZSpuN6dnZ2dRVn-yZ2dnZ0@giganews.com...
>
>>>I have to build a lowpass filter:
>>>
>>>cuttoff freq = 0.1;
>>>attenuation = 90 dB;
>>>transition = 0.01;
>>>passband ripple = 0.000275 dB;
>>>
>>>Using a single eruiripple FIR, the attenuation is too small or
>>
>>transition
>>
>>>is too long or the number of taps is enormous.
>>>When using set of filters, the passband ripple will be the problem.
>
> Jaan,
>
> OK - let's see if I can paraphrase what you need:
>
> You have a sequence of 15-bit samples at some sample rate fs.
> You want to reduce the sample rate by 10 to fs/10.
> You want no passband error.
> You want no aliasing errors.
Assuming this is what Jaan needs, it may be desirable to do a
decimate-by-5 stage with a transition band of .1 to .3
followed by a decimate by 2 stage with a transition band of .45 to .55
The following filter designs would decimate by 10 and leave 90% of the
resultant bandwidth "perfect" (90dB) and the top 10% would be a
transition band (with some aliasing).
stage1h = remez(60,[0 .1 .3 1 ],[1 1 0 0]);
stage2h = remez(110,[0 .45 .55 1 ],[1 1 0 0]);
The stage 1 filter is applied at 1/5 the input sample rate.
The stage 2 filter is applied at 1/10 the input sample rate.
This staged approach is comparable in processing cost to filtering the
input signal with a 23 coefficient filter (61/5+111/10 == 23.3).
To further decrease the computational cost, take advantage of the fact
that the second stage is a half-band filter. Thus roughly half the
coefficients are zero and can be skipped.
Both stages are symmetric filters, thus half their multiplies can be
eliminated.
Combining all these optimizations, we are left with about 9 multiplies
per input sample.
In order to do the same thing with a single filtering stage, the
effective length of the filter would be over 600 taps (applied at 1/10
the input rate). This would require about 60 multiplies (or 30 if
symmetry is exploited) per input sample.
-- Mark
Reply by Fred Marshall●September 13, 20052005-09-13
"jaan" <jants.sepp@solo.delfi.ee> wrote in message
news:gpCdnZ2dnZ1REL7UnZ2dnZSpuN6dnZ2dRVn-yZ2dnZ0@giganews.com...
> >I have to build a lowpass filter:
>>
>>cuttoff freq = 0.1;
>>attenuation = 90 dB;
>>transition = 0.01;
>>passband ripple = 0.000275 dB;
>>
>>Using a single eruiripple FIR, the attenuation is too small or
> transition
>>is too long or the number of taps is enormous.
>>When using set of filters, the passband ripple will be the problem.
>>
>>Is it practically possible to build at all?
>>
>>
>>
>>
>>This message was sent using the Comp.DSP web interface on
>>www.DSPRelated.com
>>
>
> This filter is needed, because I have to divide the clock frequency of
> 15-bit signal by 10 with no bit errors in the given passband due to
> aliasing nor due to passband ripple.
> Even 510-taps 10-phase decimation FIR (51 taps per phase) is too poor for
> this.
>
> The post of Ricardo was interesting, but unfortunately written in Matlab
> terms. I have no Matlab with the latest version of the Filter Design
> Toolbox. The $10 000 package is a bit expensive for me. I have used
> WinFIRDesigner freeware (written by Harald Zottmann) for designing single
> filters and "manually" checked the transfer of composed multifilter
> system.
Jaan,
OK - let's see if I can paraphrase what you need:
You have a sequence of 15-bit samples at some sample rate fs.
You want to reduce the sample rate by 10 to fs/10.
You want no passband error.
You want no aliasing errors.
First, you need to better define what an "error" is.
I don't think you can say: "Look, what I want is to take every 10th sample
with exactly the same value as originally sampled" that objective isn't
realizable because those samples include higher frequency terms.
Otherwise, you would simply select every 10th sample and be done with it -
but that would cause aliasing.
So, I don't quite know how you want to define or measure an "error".
I guess you could philosophically do this:
"*perfectly* lowpass filter the data with no numerical noise introduced" -
this implies infinite precision arithmetic I believe
"once lowpass filtered, decimate by 10"
Decimation by 10 requires a pretty sharp filter.
You may do better by decimating by 2, 2 times in succession and finally by
2.5.
The filters needed are much less sharp.
You may wish to investigate maximally flat filters for the passband as well.
Since the passband of interest is so much smaller than what you start with,
a maximally flat filter may give pretty good results regarding passband
error.
A test for error might look something like this:
1) Generate the filtered output at fs/10.
2) Interpolate the filtered output up to fs such that the values on the
starting samples at fs/10 remain unchanged. Some interpolation methods do
this.
3) Take the interpolated samples at fs and subtract the original samples
(properly time-registered). This represents the error between the two
sequences at fs.
4) Compute the Fourier Transform of the error. It should have zero value
below fs/10 if the filtering (and upsampling process) are what you are
looking for (????)
I worry that the upsampling will introduce errors that you won't be able to
separate out.
Another test method:
1) Generate the filtered output at fs/10 using some "preferred method under
test".
2) Generate another filtered output at fs/10 using a known "much better"
method that is otherwise too expensive to implement for production runs but
can be done for this test.
3) Subtract the two results to find the error.
I hope this helps. It seems a challenge.
Fred
Reply by jaan●September 12, 20052005-09-12
>I have to build a lowpass filter:
>
>cuttoff freq = 0.1;
>attenuation = 90 dB;
>transition = 0.01;
>passband ripple = 0.000275 dB;
>
>Using a single eruiripple FIR, the attenuation is too small or
transition
>is too long or the number of taps is enormous.
>When using set of filters, the passband ripple will be the problem.
>
>Is it practically possible to build at all?
>
>
>
>
>This message was sent using the Comp.DSP web interface on
>www.DSPRelated.com
>
This filter is needed, because I have to divide the clock frequency of
15-bit signal by 10 with no bit errors in the given passband due to
aliasing nor due to passband ripple.
Even 510-taps 10-phase decimation FIR (51 taps per phase) is too poor for
this.
The post of Ricardo was interesting, but unfortunately written in Matlab
terms. I have no Matlab with the latest version of the Filter Design
Toolbox. The $10 000 package is a bit expensive for me. I have used
WinFIRDesigner freeware (written by Harald Zottmann) for designing single
filters and "manually" checked the transfer of composed multifilter
system.
Jaan.
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
Reply by Fred Marshall●September 10, 20052005-09-10
"jaan" <jants.sepp@solo.delfi.ee> wrote in message
news:8fudncVmk8Ux5rzeRVn-vw@giganews.com...
>I have to build a lowpass filter:
>
> cuttoff freq = 0.1;
> attenuation = 90 dB;
> transition = 0.01;
> passband ripple = 0.000275 dB;
>
0.000275dB would appear to mean a passband ripple of 1.0 +/- 0.0000316
That is 20*log10(1.0000316/1.0000)=0.000275dB
-90dB sidelobe peaks in the stopband with passband of gain 1.0 yield
absolute stopband peaks of +/-0.0000316.
That is, 20*log(0.0000316)= -90dB
It does appear that 0.000275dB in the passband is the same absolute ripple
as -90dB in the stopband. It is 0.0000316. So there need be no weighting
between stopband and passband in the optimization algorithm.
I believe that others define this same situation as having ripple at -90dB
in both stopband and passband.
It requires a rather long FIR filter to accomplish -90dB ripple and a very
narrow transition .01/.5= 2%.
A rule of thumb says that the transition must be no less than the reciprocal
of the length. So, a transition of 0.01 would have a length of 100.
Made more concrete, .01*fs = 0.01/T where fs is the sampling frequency and
T=1/fs is the sampling interval.
The minimum length of the filter, without consideration for in-band ripple
would then be 100 by this rule of thumb. Indeed, filters of length 65
appear to meet the transition criterion with -18dB ripple.
Filters of length 105 yields -25dB ripple
Filters of length 125 yield -28dB
etc. until you get to -90dB at a length of around 500 I do believe.
There are estimating formulas that determine the necessary length for given
filter parameters.
Fred
Reply by Ricardo Losada●September 9, 20052005-09-09
Given your specs, a multistage design would probably be the best approach.
If you have the latest version of the Filter Design Toolbox (version
3.3) for MATLAB, try:
f=fdesign.lowpass(0.1-0.005,.1+0.005,0.000275,90)
h(1)=equiripple(f);
h(2)=multistage(f);
You reduce the total number of multipliers but more significantly, you
reduce the number of multiplications per input sample considerably.
Also, since you are reducing the bandwidth significantly, you should
consider reducing the sampling rate accordingly. If you can tolerate
transition band aliasing (or you can remove the aliasing with a filter
following the decimation), you could use a 10th-Band (Nyquist)
multistage decimation filter:
f=fdesign.decimator(10,'nyquist',10,0.01,90)
h(3)=multistage(f);
Unfortunately, your strict passband ripple spec is not quite met,
although the passband ripple is still very small:
measure(h(3))
ans =
Sampling Frequency : N/A (normalized frequency)
Passband Edge : 0.095
3-dB Point : 0.099077
6-dB Point : 0.1
Stopband Edge : 0.105
Passband Ripple : 0.0017999 dB
Stopband Atten. : 90.7347 dB
Transition Width : 0.01
If you really need the passband ripple spec met, then use:
f=fdesign.decimator(10,'lowpass',0.1-0.005,.1+0.005,0.000275,90);
h(4)=multistage(f);
measure(h(4))
ans =
Sampling Frequency : N/A (normalized frequency)
Passband Edge : 0.095
3-dB Point : 0.099335
6-dB Point : 0.10023
Stopband Edge : 0.105
Passband Ripple : 0.00025654 dB
Stopband Atten. : 90.4299 dB
Transition Width : 0.01
Which will be more expensive than the Nyquist multistage design, but
still only about 35 multiplications per input sample if you use a
polyphase implementations (compared to over 1100 multiplications per
input sample if you use the single-rate equiripple design).
This can still be improved upon if you use halfband filters (for one of
your stages):
h(5)=multistage(f,'UseHalfbands',true);
measure(h(5))
ans =
Sampling Frequency : N/A (normalized frequency)
Passband Edge : 0.095
3-dB Point : 0.099137
6-dB Point : 0.1
Stopband Edge : 0.105
Passband Ripple : 0.00026 dB
Stopband Atten. : 90.7578 dB
Transition Width : 0.01
Now you are down to about 24 multiplications per input sample and about
182 multipliers in total.
Of course if you need to remove the transition band aliasing, you need
to add the cost of a post filter to do so. But this shouldn't be too
bad, given that you have reduced the sample rate by 10.
Hope this helps.
Sorry for the long post,
Ricardo.
jaan wrote:
> I have to build a lowpass filter:
>
> cuttoff freq = 0.1;
> attenuation = 90 dB;
> transition = 0.01;
> passband ripple = 0.000275 dB;
>
> Using a single eruiripple FIR, the attenuation is too small or transition
> is too long or the number of taps is enormous.
> When using set of filters, the passband ripple will be the problem.
>
> Is it practically possible to build at all?
>
>
>
>
> This message was sent using the Comp.DSP web interface on
> www.DSPRelated.com
Reply by Rune Allnor●September 9, 20052005-09-09
jaan wrote:
> I have to build a lowpass filter:
>
> cuttoff freq = 0.1;
> attenuation = 90 dB;
> transition = 0.01;
> passband ripple = 0.000275 dB;
>
> Using a single eruiripple FIR, the attenuation is too small or transition
> is too long or the number of taps is enormous.
> When using set of filters, the passband ripple will be the problem.
>
> Is it practically possible to build at all?
Why do you constrain the passband ripple like that? If I have
converted correctly to linear scale, the passband allows deviation
only in the 5th significant digit:
ripple = 10^(-0.000275/20) = 0.99996833995616
It comes as no surprise that there are many coefficients in
such a filter. What do you find? 10000 coefficients? More?
Unless you have very good reasons for this spec, I think the
problem here is the specification, not the filter design algorithm.
Rune
Reply by jaan●September 9, 20052005-09-09
I have to build a lowpass filter:
cuttoff freq = 0.1;
attenuation = 90 dB;
transition = 0.01;
passband ripple = 0.000275 dB;
Using a single eruiripple FIR, the attenuation is too small or transition
is too long or the number of taps is enormous.
When using set of filters, the passband ripple will be the problem.
Is it practically possible to build at all?
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com