Hello, I am trying to calculate the z transform of a digital integrate and dump process and it's stumping me. The z transform of a continuously calculated moving average of N samples with unity weights (after quite a bit of algebra)is: (1/N)*(1-Z^-N)/(1-Z^-1), but the integrate and dump is different. My thought was to just re-sample the aforementioned averages calculated at an rate fs1 at a new rate fs2=fs1/N to model the process of a buffer filling with N samples, the average being computed, the buffer reset to zero, and the process beginning again. I am not sure how to write the z transform of this process. The other way I was thinking about it was to convolve the moving average result at fs1 with an impulses at 0,+/-n*fs2. I did this by hand and it looks like a bunch of sinc functions: one centered at 0Hz and the others at +/-n*Fs/N, just like I would guess. I did not sum them all up to get an overall response, but I guess I could. Isn't there just an equation for the z transform of this process? This seems like a fundamental DSP or Communications problem (only I can't solve it). It's the front end of a digital control loop that we are making some changes to. Thanks, John M.
Z transform of an integrate and dump process
Started by ●April 9, 2010
Reply by ●April 9, 20102010-04-09
JM1970 wrote:> Hello, > I am trying to calculate the z transform of a digital integrate and dump > process and it's stumping me. The z transform of a continuously calculated > moving average of N samples with unity weights (after quite a bit of > algebra)is: (1/N)*(1-Z^-N)/(1-Z^-1),More accurately it is 1/N * (sum from n = 1-N to 0 of z^n) -- your way is technically correct, but contains a pole-zero cancellation that isn't present if you're doing a paranoid moving average.> but the integrate and dump is > different. My thought was to just re-sample the aforementioned averages > calculated at an rate fs1 at a new rate fs2=fs1/N to model the process of a > buffer filling with N samples, the average being computed, the buffer reset > to zero, and the process beginning again.That is a correct mathematical model.> I am not sure how to write the z transform of this process.That is because, strictly speaking, you cannot model this with a z transform. The z transform is for shift-invariant systems, the "and dump" part of your system is pretty strongly shift varying.> The other way I was thinking about it was to > convolve the moving average result at fs1 with an impulses at 0,+/-n*fs2. > I did this by hand and it looks like a bunch of sinc functions: one > centered at 0Hz and the others at +/-n*Fs/N, just like I would guess. I > did not sum them all up to get an overall response, but I guess I could.This is a more or less valid thing to do in a discrete-time Fourier process world, but far less so for a strict z transform.> Isn't there just an equation for the z transform of this process?No, see my above comment about shift-invariance.> This > seems like a fundamental DSP or Communications problem (only I can't solve > it). It's the front end of a digital control loop that we are making some > changes to.That system makes a good filter for the front end of a digital control loop. It's the one FIR filter that I'll routinely let get close to a loop. It does add more delay for the attenuation than an IIR filter, but since it puts a notch right at every non-zero harmonic of the sampling frequency it pays for itself. Anything that might alias down to DC (which is usually the frequency you care most about) gets stomped into nothing, and for that I'm willing to put up with some delay. As stated, you can't model this exactly as a block with a z transform. If you start from a known plant transfer function in the Laplace domain, a known delay in the controller, the zero-order-hold behavior of the output DAC, and this filter's behavior, then you can get an exact z-domain transfer function of the plant --> as seen by the digital controller <--. But the math isn't obvious (I should write a little paper for my web site!), and the gain is small. The amount of phase shift and attenuation that this filter lends to all but the most aggressive control loops is small, and can be modeled adequately by fitting your frequency-domain plot to a 1-st order filter, or just a one-step delay. I used to go to great pains to model these -- then I discovered that I was making exact models of systems whose real plant behavior diverged enough from my modeled plant behavior far more than any exactness I gained by doing the detailed model. So now I just approximate the filter with one step of delay for my preliminary work, and for the actual loop design I measure the plant behavior as seen by the controller and use that to design and tune the controller. The one step of delay is usually pessimistic, which means that if I see success happening with my theoretical plant model and the (pessimistic) one step of delay, then when the rubber hits the road and I'm tuning a controller to a real plant I meet success more often than not. HTH -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●April 12, 20102010-04-12
On 4/9/2010 10:54 AM, JM1970 wrote:> Hello, > I am trying to calculate the z transform of a digital integrate and dump > process and it's stumping me. The z transform of a continuously calculated > moving average of N samples with unity weights (after quite a bit of > algebra)is: (1/N)*(1-Z^-N)/(1-Z^-1), but the integrate and dump is > different. My thought was to just re-sample the aforementioned averages > calculated at an rate fs1 at a new rate fs2=fs1/N to model the process of a > buffer filling with N samples, the average being computed, the buffer reset > to zero, and the process beginning again. I am not sure how to write the z > transform of this process. The other way I was thinking about it was to > convolve the moving average result at fs1 with an impulses at 0,+/-n*fs2. > I did this by hand and it looks like a bunch of sinc functions: one > centered at 0Hz and the others at +/-n*Fs/N, just like I would guess. I > did not sum them all up to get an overall response, but I guess I could. > Isn't there just an equation for the z transform of this process? This > seems like a fundamental DSP or Communications problem (only I can't solve > it). It's the front end of a digital control loop that we are making some > changes to. > > Thanks, > John M. >If you're resampling the data at the "and dump" rate, i.e. each output sample represents the sum of M input samples, then I believe it should look just like a 1st order CIC decimator. -- Rob Gaddi, Highland Technology Email address is currently out of order