Professional Documents
Culture Documents
1. Interpolation
Samples from the sinusoid f (x) = sin(0.2πx) are shown in Figure 1. Draw the results of interpolation using
each of the following three methods:
x − x1 x − (−1)
L0 (x) = = = x+1
x0 − x1 0 − (−1)
and
x − x0 x − (0)
L1 (x) = = = −x
x1 − x0 (−1) − (0)
. Then
P2 (x) = f (x0 )L0 (x) + f (x1 )L1 (x) = 4(x + 1) + (−3)(−x) = 7x + 4
We can sketch those equations on the 2D plane as follows:
(a) Given three data points, (2, 3), (0, −1), and (−1, −6), find a polynomial f (x) = ax2 + bx + c fitting
the three points. Do this by solving a system of linear equations for the unknowns a, b, c. Is this
polynomial unique?
Solution:
Plug in the three data points into f (x) = ax2 +bx+c, we get 4a+2b+c = 3, c = −1 and a−b+c = −6.
Solving these equations for the coefficients a, b and c, we get f (x) = −x2 + 4x − 1.
This polynomial is the unique degree 2 polynomial defined by these three distinct points.
(b) Like the monomial basis {1, x, x2 , x3 , . . .}, the set {Li (x)} is a new basis for the subspace of degree n
or lower polynomials. Pn (x) is the sum of the scaled basis polynomials. Find the Li (x) corresponding
to the three sample points in (a). Show your work.
Solution:
Assume x0 = 2, x1 = 0 and x2 = −1, each corresponding Li (x) is:
(x − x0 ) (x − x2 ) (x − 2) (x − (−1)) x2 − x − 2
L1 (x) = = =
(x1 − x0 ) (x1 − x2 ) (0 − 2) (0 − (−1)) −2
(x − x0 ) (x − x1 ) (x − 2) (x − 0) x2 − 2x
L2 (x) = = =
(x2 − x0 ) (x2 − x1 ) (−1 − (2)) (−1 − 0) 3
(c) Find the Lagrange polynomial Pn (x) for the three points in (a). Compare the result to the answer in (a).
Are they different from each other? Why or why not?
Solution:
x2 + x x2 − x − 2 x2 − 2x
Pn (x) = f (x0 )L0 (x) + f (x1 )L1 (x) + f (x2 )L2 (x) = 3 × + (−1) × + (−6) ×
6 −2 3
Therefore, Pn (x) = −x2 + 4x − 1.
The answer is the same as the one we computed in (a). For these three points, we cannot have a
polynomial of less than 2 degree fitting all of them. Lagrange interpolation must construct the least
degree (n = 2) polynomial passing the three points, which must be unique.
(d) Sketch Pn (x) and each f (xi )Li (x) on the 2D plane.
Solution:
j=n−1
(xi − x j )
Li (xi ) = ∏ = 1.
j=0; j6=i (xi − x j )
j=n−1
(xi − x j )
For any other Lm (x), where m 6= i, plug in xi , Lm (xi ) = ∏ . Because m 6= i, Lm (xi ) must
j=0, j6=m (xm − x j )
(xi −xi )
have this term (xm −xi ) = 0. Hence all Lm (xi ) must be zero.
Therefore, Pn (xi ) = ∑k=n−1
k=0 f (xk )Lk (xi ) = f (xi ) · 1 = f (xi ).
p(x) = p0 + p1 x + p2 x2 + · · · pn xn ,
where we assume that the coefficients p0 , p1 , . . . , pn are real. Let Pn be the vector space of all polynomials
of degree at most n.
Show that the set Bn = {1, x, x2 , . . . , xn } forms a basis of Pn , by showing the following.
• Every element of Pn can be expressed as a linear combination of elements in Bn .
• No element in Bn can be expressed as a linear combination of the other elements of Bn .
(Hint: Use the aspect of the fundamental theorem of algebra which says that a nonzero polynomial
of degree n has at most n roots and use a proof by contradiction.)
Solution:
We can write every polynomial of degree n on x as p(x) = p0 + p1 x + · · · pn xn , which is a linear
combination of the elements in Bn .
Let xi ∈ Bn , for 0 ≤ i ≤ n. We show that xi cannot be written as a linear combination of the other
elements of Bn . Suppose that there exist real constants c j for j 6= i, such that xi = ∑ j6=i c j x j . This gives
us an equation
∑ c j x j − xi = 0 .
0≤ j≤n, j6=i
The left hand side is a nonzero polynomial of degree at most n, which we know has at most n roots
by the relevant aspect of the fundamental theorem of algebra. Thus the equality cannot hold for all x,
which is a contradiction.
Solution:
We can write each equation p(xi ) = yi as
p0
i p1
h
p0 + p1 xi + p2 xi2 + · · · + pn xin = 1 xi xi2
· · · xin
.. = yi .
.
pn
If we arrange these n + 1 equations into a matrix, we get
1 x0 x02 · · · x0n p0 y0
2 n
1 x1 x1 · · · x1 p1 y1
.. = .. .
. . .. .. ..
. .
. . . . . . .
2
1 xn xn · · · xn n pn yn
h i
The matrix V above with rows 1 xi xi2 · · · xin is also known as a Vandermonde matrix.
(c) For the case where n = 2, compute the determinant of V and show that it is equal to
det(V ) = ∏ (x j − xi ) .
0≤i< j≤n
Show that this satisfies the following properties of a real inner product. (We would need a complex
conjugate if we wanted a complex inner product).
• hp, pi ≥ 0, with equality if and only if p = 0.
• For all a ∈ R, hap, qi = ahp, qi.
• hp, qi = hq, pi.
Solution:
1
p2 (x) dx ≥ 0 since p2 (x) ≥ 0 for all x. The integral is 0 if and only if p = 0 for all x,
R
• hp, pi = −1
or p is the zero polynomial.
R1 R1
• hap, qi = −1 (ap(x))(q(x)) dx = a −1 p(x)q(x) dx = ahp, qi.
R1 R1
• hp, qi = −1 p(x)q(x) dx = −1 q(x)p(x) dx = hq, pi.
(e) OPTIONAL: An alternative inner-product could be placed upon real polynomials if we simply repre-
sented them by a sequence of their evaluations at 0, 1, . . . , n and adopted the standard Euclidean inner
product on sequences of real numbers. Can you give an example of an orthonormal basis with this
alternative inner product?
Solution:
For p, q ∈ Pn , this alternative inner product is given by
n
hp, qi = ∑ p(i)q(i) .
i=0
An example of an orthonormal basis with this inner product would be the Lagrange polynomials Li (x)
constructed on the points 0, 1, . . . , n. Since Li (i) = 1 and Li ( j) = 0 for j 6= i, 0 ≤ i, j ≤ n, thus for i 6= j
we clearly have hLi , L j i = 0 and we can also check that hLi , Li i = 1.
4. Sinc Functions
The sinc function is defined as (
sin(πx)
πx , x 6= 0
sinc(x) = .
1, x=0
d
sin(πx) dx sin(πx)
lim = lim d
x→0 πx x→0
dx πx
π cos(πx)
= lim
x→0 π
= 1 = sinc(0)
Solution:
1 sin (ωx) π
1
Z π
cos(ωx)dω =
π 0 π x ω=0
sin (πx)
=
πx
(c) If we think of the above integral as a sum of oscillatory functions of different frequencies, the sinc
function has continuous frequency components in the range [0, π]. What is the range of frequencies of
the function
x
f (x) = sinc ?
T
Hint: Try to use substitution and the above integral.
Solution:
We have,
1
Z π
ωx
cos dω
π 0 T
ω
Let λ = T. Then,
π
1
Z
T
π cos (λ x) dλ
T 0
π
Since we’re summing
π over a continuum of frequencies from 0 to T, this tells us that the range of
frequencies is in 0, T .
(d) Continuing the idea of integration as the continuous version of sums, we define the continuous inner
product between two real functions as
Z ∞
hp, qi = p(x)q(x)dx.
−∞
what is the analogous length squared of a function, f , using the inner product definition above? This
is a one-line answer.
Solution:
Z ∞
2
kfk = hf, fi = | f (x)|2 dx
−∞
We only consider interpolating functions where k f k < ∞, so the inner product is well defined. It turns out
that the set of shifted sinc functions are orthonormal with the above inner product! Let
5. LTI Inputs
We have an LTI system whose exact characteristics we do not know. However, we know that it has a finite
impulse response that is not longer than 5 samples. We also observed two sequences, x1 and x2 , pass through
the system and observed the system’s responses y1 and y2 .
x1 0 2 2 0 −1 0 0 0 0 0
y1 0 4 10 8 −2 −3 1 1 −1 0
x2 −2 0 1 0 0 0 0 0 0 0
y2 −4 −6 0 5 −1 −1 1 0 0 0
(a) Given the above sequences, what would be the output for the input?
x3 0 0 −2 0 1 0 0 0 0 0
Solution:
This is a shifted version of x2 . Since the system is time-invariant, the output is:
y3 0 0 −4 −6 0 5 −1 −1 1 0
(c) Given the above information, how could you find the impulse response of this system? What is the
impulse response?
Solution:
Since 21 (x1 + x3 ) is an impulse at the second sample, 1
2 (y1 + y3 ) is the system’s impulse response
starting from the second sample.
y1 + y3 0 4 6 2 −2 2 0 0 0 0
so
n n<0 0 1 2 3 4 n>4
h[n] 0 2 3 1 −1 1 0
(d) What is the output of this system for the following input:
x4 1 1 1 0 0 0 0 0 0 0
Solution:
y4 2 5 6 3 1 0 1 0 0 0
(a) Write the impulse responses h[n] for (1) and (2). Are they IIR or FIR?
Solution:
For (1), (
0.5n , n ≥ 0
h[n] =
0, n<0
This has an infinite impulse response (IIR).
For (2), (
0.25, n = 0, 1, 2, 3
h[n] =
0, otherwise
This has a finite impulse response (FIR).
(b) Are either of these filters causal? Are either of these filters stable?
Solution:
Yes, y[n] depends only on inputs from x[n] and before.
Yes, both filters are stable because the impulse responses are absolutely summable.
(a) Perform polynomial interpolation on these points. Show your work (you can use a computer to calcu-
late the matrix inverse).
Solution:
Since there are three points, we can find a unique second-order polynomial that will pass through all
of the points:
1 x1 x12 a0 y1
2
1 x2 x2 a1 = y2
1 x3 x32 a2 y3
Plugging in the values from the table, we have:
1 0 0 a0 3.75
1 0.5 0.25 a1 = −1.5
1 1.5 2.25 a2 −8.5
Contributors:
• John Maidens.
• Siddharth Iyer.
• Justin Yim.