# Finding the coefficients of the block diagram

I was looking at the question from a textbook of mine and it doesn't make too much sense to me:

Design a ﬁrst-order ﬁlter, linearly extrapolating the current and previous measurement. This is equivalent to the assumption that the upcoming measurement will be on a straight line connecting the current and previous measurement. The output of the ﬁlter shall anticipate this by giving this output now.

The coefficients (2 and -1) are given in the answer, but I still don't understand how they were found.

I know that the general equation of a digital filter is given as:

$$$$y[k] = \sum_{i=0}^{N} b_i u[k-i] - \sum_{j=1}^{N} a_i y[k-j]$$$$

How does one go from that, using the description of the problem, to:

$$$$y[k] = 2 x[k] - x[k-1]$$$$

This is the answer given in the book:

• Hint : think about y = m*x+b
– Ben
Sep 16, 2020 at 19:06

Basically, there are 2 parts to this problem

Step 1 :

Find the slope between the last 2 samples. The slope is simply the difference between the last 2 samples.

$$m = x[n]-x[n-1];$$

Step 2 :

You need to extrapolate to find the next sample based on the hypothesis that the next sample will be colinear with the 2 previous samples.

$$x[n+1] = x[n] + m$$

$$x[n+1] = x[n] + x[n] - x[n-1] = 2x[n] - x[n-1]$$

If you assume that the samples lie on a line then the current sample is related to the previous sample by

$$x[n]=x[n-1]+c\tag{1}$$

with some unknown constant $$c$$. If there are two past samples given, then $$c$$ is simply determined by the difference between these two samples:

$$c= x[n-1]-x[n-2]\tag{2}$$

Combining $$(1)$$ and $$(2)$$ gives

$$x[n]=2x[n-1]-x[n-2]\tag{3}$$

• you beat me to it. I will delete my answer!
– Ben
Sep 16, 2020 at 19:11
• @Ben: same thought at the same time :) Sep 16, 2020 at 19:12