Re: Digitally compensating a low-pass (integrator)

On 09/24/2010 02:12 PM, Peter Mairhofer wrote:
Hi,

I have a signal f(t) with nyquist rate W, i.e. the maximum frequency is
W/2.

Nyquist did not say that:
http://www.wescottdesign.com/articles/Sampling/sampling.html

This signal is filtered with an integrator (simulated in Simulink) the
following way:

f_I(t) = \int_t^{t+1/W} f(t) dt

In words: I integrate the signal for a period of 1/W, then the
integrator is reset. It is obvious that the signal won't be the same
afterwards; however I only integrate for 1/nyquistrate long. So I think
it should be possible to compensate this filter in digital domain.

Yes an no. The filter has a zero at W/2, and so kills any information that may be in the signal at that frequency -- but that's also the alias frequency for DC, so killing that signal may be a good thing.

Certainly you can correct for some

The equation above should be the same as the following block diagram:

f(t) +------------+
>-+---------------+ Integrator +--------------+----> f_I(t)
| +------------+ ^ -
| |
| +-----------------+ +------------+ |
+--+ exp(-j*Omega*T) +---+ Integrator +-----+
+-----------------+ +------------+

Now I want to compensate the effect of this analog filter in digital
domain (e.g. using MATLAB and filter()).

Hopefully using something real, at some point.

Using the equivalent circuit and the bilinear transform as tool I got
something like H(z) = T/2 * (z+1)/z

So the inverse is 2/T * 1/(1 + z^-1)

Clearly this filter is unstable and therefore it does not work.

Well, it's metasable, and it won't work. You're also using the bilinear transform for behavior that's at a frequency well outside of where the approximation breaks down.

How could I compensate this filter digitally when I have the nyquist
samples of f_I(t) ?

"Nyquist sample?" Is this term defined in writing anywhere in the universe other than your post just now?

PS: The whole thing should be equivalent to oversample f(t) with a
factor of e.g. 100, that is, the sampling rate is W*100; and afterwards
summing up 100 consecutive samples in digital domain ... At least I get
the same "distortion" in this case as with the SIMULINK simulation

Well, no. The whole thing can be _approximated_ by oversampling, then doing a sum-and-dump instead of an integrate-and-dump, but it isn't the _same_.

What are you really trying to _do_? Following an integrate-and-dump stage with a sampler is something that I might have done in a digital control loop ten or fifteen years ago, as a way of notching out all the noise that can alias down to DC without doing great violence to my low frequency amplitude or phase accuracy. But I don't see much utility in it anywhere else, and these days it's better to sample extra fast and do a sum-and-dump in the digital world.

I don't see much point in doing this with, say, an audio signal -- it's a lot of work for a rather pedestrian anti-alias filter for that sort of signal.

If it _is_ audio then (a) you need to learn more about the Nyquist-Shannon theorem and its implications, (b) it's probably not a good method, and (c) you can approximate an inverse filter, up to the actual frequency content of your signal, to whatever precision you're willing to choke out of the software and to add delay for.

If it's a control loop, then you neither want to nor do you need to compensate for the effect explicitly -- just model it as part of your plant behavior, and tune around it. That'll be enough compensation right there.

If it's something else yet again -- it depends.

So, again, in harmony: what are you _really_ doing?

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html
.

Relevant Pages

• Re: Compensate system response
... filter design etc. ... filter that will compensate this system. ... be decomposed into minimum phase system and all-pass network. ... So my idea was to compensate in two steps: 1) find minimum phase ...
(comp.dsp)
• Re: Switch-Synchronous Sampling in SMPSs
... Why are we multiplying these two signals? ... some of that noise will be ... filter, ... In a control loop delay matters, ...
(comp.dsp)
• Re: Compensate system response
... filter design etc. ... filter that will compensate this system. ... response - magnitude and phase. ... be decomposed into minimum phase system and all-pass network. ...
(comp.dsp)
• Re: Compensate system response
... filter design etc. ... will compensate this system. ... into minimum phase system and all-pass network. ...
(comp.dsp)
• Re: 24/48 v 24/96
... For any cutoff frequency and filter order? ... One of my favorite tricks when implementing a digital control loop is to sample the ADC as fast as I can, with as simple an analog anti-aliasing filter as I can get away with, followed by some prefiltering and decimation in the digital world. ... With a high enough ratio between the ADC sampling rate and the characteristics of the plant, the analog anti-aliasing filter often becomes a simple RC filter, or nothing at all. ...
(comp.dsp)