# What's the Laplace transfer function of a moving average?

What is the Laplace transfer function of a moving average? $$y_k=\frac{x_k+x_{k-1}+x_{k-2}+x_{k-3}+...+x_{k-N+1}}{N}$$ I tried to get it from the z-domain transfer function using conversion tables: $$\frac{y_k}{x_k}=\frac{1+z^{-1}+z^{-2}+z^{-3}+...+z^{-N+1}}{N}$$

But unless I've read them wrong they don't have the "bricks" I need to get me anywhere.

• You ask for Laplace transform, but then ask about the Z domain. Make up your mind. – Olin Lathrop Feb 13 '15 at 13:28
• @Olin: I ask for Laplace transform, and tell that I tried to get it from the z transform and couldn't get it. – Mister Mystère Feb 13 '15 at 13:31
• The edited question refers to transforming from Z to S domains. I think you need to convolve the Z transfer function with a rectangular window function in the time domain (sinc function in the S-domain) assuming zero-order hold. Hopefully that'll get you headed in the right general direction. – Brian Drummond Feb 13 '15 at 13:31

$$\frac{y_k}{x_k}=\frac{1+z^{-1}+z^{-2}+z^{-3}+...+z^{-N+1}}{N}$$

can be re-written as

$$\frac{y_k}{x_k}=\frac{1}{N}\frac{1-z^{-N}}{1-z^{-1}}$$

That should be straightforward to model in the s-domain by replacing z by $$e^{sT}$$

i.e. $$H(s)=\frac{1}{N}\frac{1-e^{-sTN}}{1-e^{-sT}}$$ 

This is a SINC function in the frequency domain whose magnitude versus frequency is of the form: $$\dfrac{sin(\pi fN)}{Nsin(\pi f)}$$

(source)

• Thanks a lot, I replaced z by exp(sT) in the basic z form. It makes a lot of sense that z be replaced this way as a previous value is simply a delay of the sampling period. The frequency response is very interesting too. – Mister Mystère Feb 13 '15 at 14:30

Just to add to the question (as I had the same some time ago), the "continuous version" of the moving average would be the sliding window integral:

$$y(t) = \int_{t-T}^{t} u(\tau) d\tau$$

This can be written as:

$$y(t) = \int_{0}^{t} u(\tau) d\tau - \int_{0}^{t-T} u(\tau) d\tau$$

Noting that the second term is a time-shifted version of the first and taking the Laplace transform:

$$Y(s) = \frac{U(s)}{s} - \frac{U(s) e^{-sT}}{s} = \frac{1-e^{-sT}}{s} U(s)$$

(which by the way is the same transfer function as the zero-order hold)

The frequency response is a sinc function too: wolframalpha