# Output signal as convolution of impulse response and step signal

Hi All: This question is kind of an add on question to the gorgeous answer by Juancho provided at this link:

How does this "simple filter" work?

The answer explains how the limit of exponential smoothing given an impulse response $x_0$, (so that new $x_i$'s are not arriving. only $x_0$ arrives) can be computed by convolving the impulse with a step signal.

The difference between the framework at that link and my framework is that actual series is not driven by an impulse response. By this I mean that the same process, occurs over and over because a "new" $x_i$ is arriving during each period so one could think of there being an impulse response as described but occurring in each period. So, there is a step signal convolved with the first impulse response. Then, in the next period, another step signal is convolved with a second impulse, etc, etc. In other words, now there is $x_1$, $x_2$, $x_3$, ..... $x_n$, where each $x_i$ gets operated on in the same manner as described by Juancho. Assuming that my setup is clear, my question is: is there a simple recursion for this non-impulse response case. Does my case have a name ? It seems like there should be a way to use recursion but I can't figure it out. Thank you very much for any references, answers, books, whatever.

• It's an IIR filter. First order lowpass in this specific case. Read this ccrma.stanford.edu/~jos/filters or this dspguide.com/pdfbook.htm Dec 2, 2016 at 20:53
• Thanks Hilmar. I'll check out the links and let you know how they go. Dec 2, 2016 at 22:14
• I have both texts but it's gonna take me a while to sift through them for the relevant material. + my background is stats and OR ( been trying to teach myself DSP for the last year or two off and on ) which makes the process even slower. but I do appreciate it and will let you know the relevance. basically, I'm looking for a recursive algorithm similar to what juancho described for the impulse response case. thanks again. Dec 3, 2016 at 8:05
• Hi Hilmar: I haven't had any luck yet in finding anything relevant in either of those two books. If you could let me know where that might be, it's appreciated. But, there is definitely a confusion between the exponential smoothing often talked about in time series-econometrics-statistics and the one I'm referring to so this might still not be clear. I am not referring to the exponential smoothing algorithm referred to in this link. en.wikipedia.org/wiki/Low-pass_filter. I am referring to the type of exponential smoothing that Juancho describes in his answer which I link to. thanks. Dec 4, 2016 at 4:35

The answer explains how the limit of exponential smoothing given an impulse response $x_0$, (so that new $x_i$'s are not arriving. only $x_0$ arrives) can be computed by convolving the impulse with a step signal.

Actually, Juancho's answer explains how the steady state limit of the exponential smoothing filter, given the filter's impulse response and a step input $x_0 u[n]$ (where $u[n]$ is the step function), can be computed by convolving the filter's impulse response with the input signal.

In your case the input signal is not a step function so the output of the filter would not be an exponential as was the case in the linked post. Regardless, the output of the filter can still be computed with the recursion formula:

$$y[n]=(1−a)x[n]+ay[n−1]$$ or alternatively by computing a very long convolution between the infinite filter impulse response (truncated to some large length $N$ for practical purposes) and your input sequence.

As an illustration, the following Matlab script computes the output of the filter with a step input x1:

N=50;
M=4;
a = 0.8;

h = (1-a)*a.^[0:N];

x1=[zeros(1,M) 5*ones(1,N)];
y1a=conv(x1, h);             % compute output with convolution
y1b=filter(1-a, [1 -a], x1); % compute output with recursion
figure(1);
hold off; stem(x1);
hold on;  stem(y1a,'rs');
hold on;  stem(y1b,'k*');


Similarly, the same operation can be performed on a more arbitrary input sequence x2:

k = 0.5;
x2=[zeros(1,M) 5*ones(1,N)] + k*randn(1,N+M);
y2a=conv(x2, h);
y2b=filter(1-a, [1 -a], x2);
figure(2);
hold off; stem(x2);
hold on;  stem(y2a,'rs');
hold on;  stem(y2b,'k*');


It is a normal IIR filter, and a very simple one at that.

Everything that can be described with a linear time invariant difference equation is an IIR filter and can be designed and analyzed using well established mathematical methods.

You calculate the output of the filter for ANY given input (impulse, step, the Dow Jones, Wagner's Nibelungen, etc.) with the equation $$y[n] =\sum_{i=0}^{N}b_i\cdot x[n-i]-\sum_{i=1}^{N}a_i\cdot y[n-i]$$

In your case you have $b_0=0.2$ and $a_1 = -0.8$ with all the other a and b coefficients being zero, so the equation simplifies to $$y[n] = 0.2 \cdot x[n] + 0.8 \cdot y[n-1]$$

That is indeed a simple first order low pass filter with a -3dB point at a normalized frequency of 0.0355 or thereabouts. It's not a very good low pass filter since it doesn't go to zero at the Nyquist frequency. A somewhat better choice would be

$$y[n] = 0.1 \cdot x[n] + 0.1 \cdot x[n-1] + 0.8 \cdot y[n-1]$$

There are plenty of smoothing algorithms that are not IIR filters but your specific example is just a simple first order low pass.

EDIT: based on the question in the comment The equation above describes the operation for ALL input signals, not just an impulse. Let's consider the input signal x = [1.0 1.1 1.05]; So we have x[0] = 1.0, x[1] = 1.1, x[2] = 1.05, and x[3...] = 0; You would calculate the output as follows

y[0] = 0.2*x[0] + 0.8*y[-1] = 0.2; // since y[-1] = 0;
y[1] = 0.2*x[1] + 0.8*y[0]  = 0.38;
y[2] = 0.2*x[2] + 0.8*y[1]  = 0.514;
y[3] =            0.8*y[2]  = 0.4112;     // since x[3] = 0;
y[4] =            0.8*y[3]  = 0.32896;
etc.

• Thanks Hilmar: I'll read carefully and also see if what your algorithm's output matches my output. Dec 4, 2016 at 17:38
• Hi Himar: What you wrote is clear and also similar to example 2.15 in :"signals and systems" by oppeheim and wilsky, second edition, page 123. But your example describes a pure impulse response and is not convoluted with the step signal described by Juancho at this link. dsp.stackexchange.com/questions/33858/… Things become quite different once the impulse response is convoluted with the step signal K.. By including the step signal, this means that the impulse response essentially occurs at every period going forward rather than just the first period. Dec 4, 2016 at 22:17
• @markleeds Things don't become different at all. The operation works for ANY input signal. It doesn't matter if it's an impulse or step or a financial data sequence. Obviously the result is different for each input, but the operation of how to calculate the output is exactly the same. See Edits Dec 5, 2016 at 14:01
• Hi Hilmar: I'll look more carefully tomorrow because I don't have time today. Thank you for your efforts and I'll let you know. Dec 5, 2016 at 16:37
• Thanks SleuthEye and Hilmar. I think both of those answers answer my question but I didn't know if I could pick two so I just checked SleuthEye's answer.The patience and efforts of both of you is really appreciated. Dec 7, 2016 at 16:29