EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: electronx on December 11, 2023, 08:56:45 pm

Title: digital adjustment of the gain of the cut-off points of the analog filter
Post by: electronx on December 11, 2023, 08:56:45 pm
As seen in the graph, I have a bandpass filter.
(https://i.stack.imgur.com/LJu35.png)
The problem is that the signal gain decreases at the cutoff points, but I want my gain to create sharp corners, including the cutoff frequencies, and I want the gain to remain at 1.
(https://i.stack.imgur.com/oxVvO.png)
I can achieve this by increasing the orders of the filters, but there are phase distortions and increasing the stages means more opamps and more cost. For this, I plan to use an ADC at the end of the filter. Then, I hope to multiply the frequencies where attenuation occurs by certain gain coefficients and make the gain equal to 1. Is there a special name given to this type of equalization in signal processing, or what are other more logical solutions?
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: MarkT on December 11, 2023, 09:45:42 pm
I'm tempted to say "Undesirable?" or "Unnecessary?" 

I guess the point is why do you think you want this?

Perhaps you really are looking for a Chebyshev type II filter which has much sharper roll off but still a flat passband.  4-pole Butterworth filters are never going to give you sharp edges.

Perhaps if you explain the application?

You could do some heavy digital filtering to effect what you desire, but why use an analog bandpass filter at all?
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: electronx on December 12, 2023, 06:15:50 pm
It will be used in the iepe sensor and the amplitude information tells us the g force and we do not want it to be  attenuate .It would be great to get a gain of 1 at 0.7 Hz.  Or am I wrong?
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: Benta on December 12, 2023, 08:33:52 pm
Total overthinking and unrealistic expectations.
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: SiliconWizard on December 12, 2023, 09:44:59 pm
If you're gonna use an ADC at the end of your filter, why not do the filtering digitally? Adjusting the parameters of the filter will be straightforward.
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: T3sl4co1l on December 12, 2023, 11:32:00 pm
Why not calibrate the gain(freq) spectrum? If this is going to be a precision sort of device, you most likely have to, anyway.

A fluctuation of some mdB in the passband will either mean nothing, or be calibrated out.  Perhaps a "gross error" of 1 or 2 dB would be unacceptable bounds even with calibration, perhaps uniform flat group delay is a comparable priority, I don't know.

Fundamentally, you're asking the impossible: the sharper and steeper the transfer function, the higher order the filter must be, the more phase deviates from linear, and the more total group delay spent in the filter.

Put still another way: suppose you wanted an ideal brick-wall filter, a sharp discontinuity in frequency response, all or nothing at some cutoff frequency.  The impulse response of such a filter is the sinc(t) function, which has a nonzero value for almost all t < 0, i.e., the output begins ringing before the input even begins -- it must predict the future, which is impossible.  It's non-causal.  You can only have an approximately so-sharp cutoff, when sufficient delay is included, basically to create that pre-ringing starting suddenly from t >= 0, then eventually the impulse peak, and final post-ringing, that corresponds to a time-shifted and truncated sinc(t) impulse response.

The same reasoning extends to any piecewise (hard corners) function of frequency, which must have significant delay to approximate the corners to some arbitrary "sharpness".

On the upside, any reasonable, well-informed user of your product, will know and understand this, and you can simply provide the zeroes and poles of your transfer function, and all will be understood.  Or, again, it can (or depending on what kind of product this really is -- should) be calibrated, perhaps with a best-fit curve and error (deviation between fitted and real) plotted, and the parameters of that fit shown (i.e. the dominant zeroes and poles of the function).

Related example: every time you see an op-amp rated for like, "noise 0.1-10Hz", it's measured with a first-order filter, IIRC, and some amount of noise strictly outside that bound, is simply an expected part of that measurement.  Likewise for frequencies strictly within bounds, the depressions at the ends are simply a part of it.  This is more-or-less supported by plotting noise(freq) elsewhere, hopefully including the relevant span, so it's obvious there isn't a noise peak within, or just outside, this span.  Most real amps are 1/f tail in this range (or flat, for autozero/chopper types), and the noise spectrum is well-defined, without nasty bumps in it, and so the arbitrary frequency range, and the soft cutoffs, aren't important, it's all just modest ratios depending on the slope of the spectrum and it works fine as an apples-to-apples comparison.

Tim
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: Tation on December 13, 2023, 09:07:40 am
I think that the problem is not well defined. I mean, analog filter design starts knowing the maximum deviations from the ideal transfer function that your application can withstand. Such deviations are, many times, expressed as:

From the very nature of the filtering operation, one cannot expect to locate a feasible filter for any set of specs. For example, stating that the maximum acceptable attenuation in the passband is 0 dB (as is your specification of gain exactly 1.0 down to 0.7 Hz) is not realizable. No matter if analog or digital, such a filter is not realizable, period. You can indeed approximate such filter if you accept some deviation from the desired gain, say 3 dB, 1 dB, 0.1 dB or even 1 μdB. The more stringent your requirements, the higher the required order of the filter and, usually, the worse the phase distortion of an analog filter and the higher deviations in the transfer function due to component tolerances.

So, what are your on-Earth filter specs? This is:

When the above is known (at least items 1-4), then you can search between the different available approximations (Butterworth, Chebyshev, etc.) what of them can fulfil the requirements with the less effort.



Apart from increasing the filter order, if you need a sharper cutoff, there are approximations better than Butterworth:



Many times, a pass band filter is better constructed as a cascade of a high and a low pass. Is suppose that your filter is designed in such way.
Title: Re: digital adjustment of the gain of the cut-off points of the analog filter
Post by: Tation on December 13, 2023, 10:15:13 am
I forgot:

Even if you, after the analog filter, include an ADC and then a digital filter to equalize the passband extremes, you cannot achieve with 100 % fidelity the gain = 1.0 from 0.7 Hz up to x Hz goal. But you can "distribute" the filtering effort between a "coarse" analog low pass + high pass and a digital equalizing filter. A high enough order digital filter will eventually achieve some reasonable requirement about maximum deviation from G = 1 in the pass band, provided you achieve good alignment between the analog and digital parts.

But I also believe that maybe you are overthinking all this.