# Design a LTI system which returns DC value of the input signal

Suppose that $$h(t)$$ is the impulse response of LTI system. The input signal $$x(t)$$ is periodic with period $$T$$. Determine $$h(t)$$ so that the output signal $$y(t)$$ only be the DC component of $$x(t)$$. Is $$h(t)$$ necessarily unique?

My attempt:

It's known that LTI system response to the periodic input is periodic. So I think the only possible $$h(t)$$ is constant function. If we let $$h(t) = 1$$ then: $$y(t) = \int_{-\infty}^{\infty}x(\lambda)d\lambda \tag{1}$$

According to Matt L.'s answer, definition of DC value is: $$\bar{x}=\lim_{T_0\rightarrow\infty}\frac{1}{T_0}\int_{-T_0/2}^{T_0/2}x(t)dt\tag{2}$$

Clearly $$(1)$$ and $$(2)$$ are different. So what's the appropriate $$h(t)$$? Maybe question uses different definition for DC value?

• I have now also done a simulation and added plots to illustrate better about the described method. Apr 22, 2020 at 17:40
• The definition of an integral such as $$y(t) = \int_{-\infty}^\infty x(\lambda)d\lambda$$ is as a limit of an integral with finite limits. Apr 23, 2020 at 2:31
• SHW, you need to learn what the difference is between a finite power signal (periodic signals and stationary noise are in that class) and finite energy signals. Two different classes of signals. Apr 23, 2020 at 4:06
• @robertbristow-johnson I see, thank you for mentioning that. Apr 23, 2020 at 12:16

A constant impulse response won't work because if the input signal has a non-zero DC component, the output will blow up. Note that the input signal has frequency components at DC and at integer multiples of $$1/T$$, the latter being its fundamental frequency. So you simply need a filter that retains the DC component and filters out all integer multiples of $$1/T$$. Any low pass filter with a cut-off frequency less than $$1/T$$ will do the job. You just need to make sure that the low pass filter's frequency response at DC is unity, so it doesn't change the value of the input signal's DC component.

EDIT: Just to clarify, there are infinitely many filters that satisfy your requirements. You just need unity gain at DC, and zero gain at frequencies $$f_k=k/T$$, $$k=1,2,\ldots$$. Any low pass filter with unity gain at DC and a cut-off frequency $$f_c$$ satisfying $$0 is a solution (as suggested above).

But there are also other solutions, such as filters with notches at $$f_k=k/T$$, $$k=1,2,\ldots$$ (and unity gain at DC). One such filter was proposed in Hilmar's answer.

• Thanks for your answer. I'm not familiar with filters. Would you explain more, please? Maybe just an example for this question. Apr 22, 2020 at 14:25
• @S.H.W: The example would be a low pass filter that just passes the DC component and removes all periodic signal components. Any low pass filter with a cut-off frequency less than the fundamental frequency of the input signal will do the job. Apr 22, 2020 at 14:36
• Hilmar's answer gives us $$y(t) = \frac{\int_{0}^T x(\lambda)d\lambda}{T}$$Does this work always? I mean is it true for the all periodic functions that $$y(t) = \lim_{T \to \infty }\frac{\int_{0}^T x(\lambda)d\lambda}{T} = \frac{\int_{0}^T x(\lambda)d\lambda}{T}$$ Apr 22, 2020 at 20:34
• Also I wonder whether your answer considers all of the periodic signals or just exponential signals? Apr 22, 2020 at 20:39
• @S.H.W: I've added some more information to my answer. Hilmar's averaging filter is also a possible solution. Note that there are infinitely many solutions. Apr 23, 2020 at 7:45

The DC value is simply the mean. Since the signal is periodic you only need to take the mean of one period. This can be simply done with

$$h(t)=\left\{\begin{matrix} 1/T, 0 < t < T\\ 0, {\rm elsewhere} \end{matrix}\right.$$

Clearly (1) and (2) are different.

(1) will not converge, so that doesn't work

(2) is the best way for a function that's not periodic. It will work for a periodic function as well but is needlessly complicated

• Your answer leads us to $$y(t) = \frac{\int_{0}^T x(\lambda)d\lambda}{T}$$ but the mentioned definition requires $$y(t) = \lim_{T \to \infty }\frac{\int_{0}^T x(\lambda)d\lambda}{T}$$. How we can show these are equal for the all periodic signals? Apr 22, 2020 at 19:05
• You have to different T's: in the first equation it's the period of the signal, in the second one, it's the variable that you vary for the limit. It would be better to use two different symbols. Your second equation also has an error, it the integration start should be $-T$ not 0. If you want to proof identity: split the integration interval into section of length $T$ (the period) and sum over all sections. Since it's periodic, each section gives you the same answer, say $X$. So the sum over N sections is $N \cdot X$ and the length is $N \cdot T$. Divide the two and you get a constant value. Apr 23, 2020 at 12:38

I would do the following, first design a filter that notch's out just the DC. A first attempt would say to place a zero at z = 1, or at the unit circle on the real axis where real part = 1, the transfer function for this is given as $$H_{1}(z) = 1 - z^{-1} \tag{1}$$, the frequency response of this transfer function is shown below in the first figure. However this transfer function will also suppress other nearby frequencies close to DC, so we will place a pole very close to this zero and have a transfer function like $$H_{2}(z) = \frac{1 - z^{-1}}{1- 0.99z^{-1}} \tag{2}$$. The frequency response of this transfer function is shown below. The magnitude of the pole vector in the Z plane determines how much effect of the zero are we able to cancel. A simulation of notch with varying magnitude of the pole is available at the below link (at the end of the asnwer)

Now we have very much a proper notch filter, notching out DC. The effect of placing the pole just inside/under the zero is to negate the effect of the pole at nearby frequencies, but not negating it at exactly $$z =1$$ or DC.

The next step is to design the complimentary filter which is given as $$H_{3}(z) = 1 - H_{2}(z)$$.

This $$H_{3}(z)$$ when inverted would give you the desired DC filter. The frequency response of this filter is shown below: So the input $$x(n)$$ when passed through filter $$H_3(z)$$ extracts out the DC.

I have illustrated $$H_1(z)$$ and $$H_2(z)$$, just for illustration of design and motivation. It is the $$H_3(z)$$ filter that is the desired filter to extract the DC.

This method is called the pole and zero placement method of design and is apt for such scenarios. It is standard literature you can look it up on the web. I found one relevant question for you on stackecxhange itself, link below.

Filter design with zero - pole placement method

Note: Also the ideal filter here would be almost a Dirac Delta in the DTFT placed in DC, but the inverse transform of this is am infinite sequence that is always 1, which when implemented practically would need to be curtailed thus spreading the corresponding frequency response in the DTFT around zero

• You are designing so that the combined filter, the notch followed by the DC filter, should be a unity response right? They are inverse of each other? Apr 22, 2020 at 15:07
• @Engineer there is just one filter, $H_3(z)$, it extracts the desired DC, the input is passed through $H_3(z)$ Apr 22, 2020 at 15:12
• The $H_3(z)$ is the complimentary filter of of $H_2(z)$, clearly if you multiple $H_3(z)$ and $H_2(z)$at z = -1 or frequency $\pi$, they will not equal 1 since $H_3(z)$ is 0 at frequency $\pi$ Apr 22, 2020 at 15:21
• @Engineer have added the plots now for better illustration, as you would see they are complimentary to each other. Complimentary over the $-\pi$ to $\pi$ Hilbert space of square summable periodic functions Apr 22, 2020 at 17:46
• @Engineer Have an analog notch at DC, pass the input through this filter, subtract the output of this filter from the input itself (all pass filter), that should leave us with the DC being the non attenuated frquency Apr 22, 2020 at 20:36

Continuous time

Since the signal is given to be periodic with period $$T$$, it has a Fourier series. The DC value is given by

$$c_0 = \frac 1T \int_0^T x(t) \,\mathrm dt = \frac 1T \int_{t_0-T}^{t_0} x(t)\,\mathrm dt \tag{1}$$

(any arbitrary starting point $$t_0$$ is acceptable as long as the integral is over a $$T$$-second interval. Now, if we define an LTI system whose impulse response is $$h(t) = \begin{cases}\frac 1T, & 0 \leq t \leq T,\\0,&\text{elsewhere}, \end{cases}$$, then at any given time $$t_0$$, the output $$y$$ of this LTI system (when the input to this LTI system is the periodic signal $$x(t)$$) is given by \begin{align} y(t_0) &= \int_{-\infty}^\infty h(t_0-t)x(t) \,\mathrm dt\tag{2}\\ &= \int_{t_0-T}^{t_0} h(t_0-t)x(t) \,\mathrm dt\tag{3}\\ &=\frac 1T \int_{t_0-T}^{t_0} x(t)\,\mathrm dt \tag{4}\\ &= c_0 \end{align} where in going from $$(2)$$ to $$(3)$$ we have used the fact that $$h(t_0-t)$$ equals $$0$$ whenever its argument $$t_0-t$$ exceeds $$T$$ (that is, $$t < t_0-T$$) or is smaller than $$0$$ (that is, $$t > t_0$$), and in going from $$(3)$$ to $$(4)$$, we have substituted the value $$\frac 1T$$ for $$h(t_0-t)$$.

Thus, when the periodic signal $$x(t)$$ is the input to an LTI system with impulse response $$h(t)$$ defined above, the output has value $$c_0$$ for all $$t, -\infty < t < \infty$$.

Discrete time

The result is essentially similar except that we have to be a bit more careful with endpoints.

If $$x[\cdot]$$ is a discrete-time sequence with period $$N$$, then its DC value is $$X$$ where $$X[\cdot]$$ denotes the Discrete Fourier Transform of $$x[\cdot]$$. Thus, $$X = \frac 1N \sum_{n=0}^{N-1} x[n] = \frac 1N \sum_{n=n_0-(N-1)}^{n_0} x[n]\tag{5}$$ is the sum of $$N$$ consecutive elements of $$x[\cdot]$$ and the second sum in $$(5)$$ can be recognized as the first sum with its terms re-arranged. So, if we set $$h[n] = \begin{cases}\frac 1N, & 0 \leq n < N,\\0,&\text{elsewhere}, \end{cases}$$ as the unit pulse response of a discrete-time LTI system, then at time $$n_0$$, the output $$y$$ of this LTI system, when driven by the periodic discrete-time signal $$x[\cdot]$$, is given by \begin{align} y[n_0] &= \sum_{n=-\infty}^\infty h[n_0-n]x[n] \tag{6}\\ &= \sum_{n=n_0 - (N-1)}^{n_0} h[n_0-n]x[n]\tag{7}\\ &=\frac 1N \sum_{n=n_0 - (N-1)}^{n_0} x[n] \tag{8}\\ &= X \end{align} where in going from $$(6)$$ to $$(7)$$ we have used the fact that $$h[n_0-n]$$ equals $$0$$ whenever its argument $$n_0-n$$ exceeds $$N-1$$ (that is, $$n < n_0-(N-1)$$) or is smaller than $$0$$ (that is, $$n > n_0$$), and in going from $$(7)$$ to $$(8)$$, we have substituted the value $$\frac 1N$$ for $$h(n_0-n)$$.

And that's all there is to it, folks. The LTI system whose output in response to a periodic input signal of period $$T$$ (continuous time) or $$N$$ (discrete time) is the DC value of the signal at all time instants is a moving-average filter. At any specific time instant, the filter output is just the average of the continuous-time periodic input signal over the past $$T$$ seconds. or the average of the discrete-time periodic input signal over the current and the immediately-past $$N-1$$ samples, depending on which case one is considering.

Edited to address some of the criticisms in the comments following this question

Are the LTI systems described above unique? Well, No and Yes.

NO, because (i) a signal of period $$T$$ (or $$N$$) is also a periodic signal of period $$kT$$ (or $$kN$$) where $$k$$ is a positive integer and so we could average over intervals of length $$kT$$ (or $$kN$$) if we choose to do so, and (ii) we could insert a delay into the LTI system described above and still get the same boring constant DC value as the output for all time.

Yes, if in addition, we insist on the filter being as short as possible and having as little delay as possible.

As long as the input signal $$x$$ satisfies $$x(t+T) = x(t) ~ \forall \, t, -\infty < t < \infty,\tag{9}$$ or $$x[n+N] = x[n] ~ \forall \, n, -\infty < n < \infty, \tag{10}$$ the proposed solution provides the shortest filter with the least delay with the property that the filter response to $$x$$ is the DC value of the signal at all time instants.

What if $$(9)$$ and $$(10)$$ hold only for $$t, T, N \geq 0$$ and $$x$$ is $$0$$ for negative arguments? Well, the filter proposed here has a start-up transient in the output, but the output settles down to the DC value once one full period of $$x$$ has been observed and stays there for ever afterwards.

I will ignore comments re best estimators in presence of AWGN etc. There is no estimation being done here, and noise is not an issue.

Finally, I wish to comment on the solution provided in the accepted answer (written by MattL) which is that any low-pass filter with the property that its frequency response has value $$1$$ at $$f=0$$ and value $$0$$ at all nonzero integer multiples of $$\frac 1T$$ will do. As MattL points out, there are infinitely many filters with this property, but the (causal) filter with the shortest impulse response and least delay is the one described here. To see this, recall the concept of a Nyquist pulse which is defined in the time domain as a signal that has value $$1$$ at $$t=0$$ and value $$0$$ at nonzero multiples of $$T$$. There are infinitely many Nyquist pulses but the one with the smallest bandwidth is $$\operatorname{sinc}\left(\frac tT\right)$$ whose Fourier transform is $$T\cdot \operatorname{rect}(Tf)$$ giving a bandwidth of $$\frac{1}{2T}$$. MattL's solution is any filter whose frequency response is a Nyquist pulse in the frequency domain. Applying duality, the filter with the shortest impulse response is the one whose frequency response is $$\operatorname{sinc}(Tf)$$, the frequency-domain Nyquist pulse, and this impulse response must be $$\frac 1T \operatorname{rect}\left(\frac tT\right)$$ which is a rectangular pulse of duration $$T$$ and amplitude $$\frac 1T$$, as described in the solution given in this answer. So, yes, any filter whose frequency response is a (frequency-domain) Nyquist pulse will provide an output that at all times equals the DC value of the signal, but the filter with the filter with the least delay and shortest impulse response is as described above.

• Dilip, can we assume that we know, a priori, the period or fundamental frequency of the periodic signal? Apr 23, 2020 at 4:09
• The solution is definitely not unique. Apr 23, 2020 at 7:48
• It should be noted that although a moving average is the best estimator in the presence of AWGN, it is not the best choice for other scenarios, in particular when there is dominant energy in the peak of the sidelobes of the frequency response of the moving average filter. Apr 23, 2020 at 17:00

For a finite energy signal (zero power), the time average is zero. For a periodic signal (finite power but infinite energy), MattL has already mentioned that frequency components are present at $$f =k/T$$, that is multiples of $$1/T$$, where $$k$$ is integer $$-\infty \lt k \lt +\infty$$. The DC value defined on $$x(t)$$ is $$x_{DC} = \frac{1}{T}\int_{-T/2}^{T/2}x(t)d(t)=\frac{1}{T}X(f)|_{f=0}$$ The expression $$\frac{1}{T}\int_{-T/2}^{T/2}x(t)d(t)$$ is convolving $$x(t)$$ with $$h(t)=\frac{1}{T}$$, where $$h(t)$$ is $$1\text{ for }-T/2 \le t \le +T/2$$ and $$0\text{ elsewhere}$$ and taking the value at $$y(0)$$. That is, $$x_{DC}=y(t)|_{t=0}\\ \text{where } y(t)= x(t)*h(t)$$ The effect of this is in frequency domain, we are multiplying with a sinc function which is non zero at $$f=0$$ and zero at multiples of $$1/T$$. Since the sinc function value at $$f=0$$ is $$T$$, the $$1/T$$ scaling factor cancels this resulting in $$X(0)$$ being the DC value. So in summary, the DC value is the output of $$y(t)$$ at $$t=0$$, where the impulse response is $$h(t)$$ as defined above.

If $$x(t)$$ is periodic then it can be written using the Fourier series expansion as:

$$x(t)=\sum_k a_k e^{j 2\pi fkt}$$

The DC term is the one with zero frequency, so $$a_0$$ corresponds to frequency zero ($$k=0$$). If we find it we have found the amplitude of the DC component. The Fourier series coefficients are found by the equation $$a_k=\frac{1}{T} \int_T x(t) e^{-j2\pi fkt} dt$$, and for $$k=0$$ we have:

$$a_0=\frac{1}{T} \int_T x(t) dt$$

So now we need to use this information to design the impulse response $$h(t)$$. You specify that the system should only output the DC value. We use the equation for $$a_0$$ and integrate over the previous period as to keep the filter causal:

$$h_1(t)=\frac{1}{T} \int_{t-T}^{t} x(\tau) d\tau$$

The filter output ramps up to the DC level then holds. This will give the DC level for $$t \geq T$$. Plot: Illustrations for a signal with DC component equal to $$3$$ and $$T=100$$.

• But the request was for an LTI system whose output is the DC value at all times $t$ and not just at one specific time $t =T$. So I don't see how what you are proposing is an answer to the question. Apr 23, 2020 at 2:35
• @DilipSarwate Thanks, must've read the question too quickly Apr 23, 2020 at 11:20