Duality of convolution and multiplication.#
We will go over an example to illustrate the duality of convolution and multiplication.
Suppose we are given two continuous time periodic signals \(x(t)= \sin(4\pi t)\) and \(y(t) = \cos(4\pi t)\), with \(a_k\) and \(b_k\) being their spectral coefficients, respectively:
Compute the spectral coefficients of \(z(t) = x(t)y(t)\).
Here we will use the duality of convolution and multiplication to find out the spectral coefficients of \(z(t)\).
import sympy as sym
from sympy import I # the imaginary number "j" is represented as "I" in SymPy
t, tau = sym.symbols('t tau', real=True)
x = sym.cos(4*sym.pi*t)
y = sym.sin(4*sym.pi*t)
T=1/2
omega0 = 4*sym.pi
Let’s first find the coefficient of \(x(t)\) and \(y(t)\). Here are \(x(t)\)’s coefficients:
# let's write a function to compute the kth spectral coefficient
def compute_ak(x, T, omega0, k):
ak = (1/T)*sym.integrate(x*sym.exp(-I*omega0*k*t), (t, 0, T))
return ak
a = []
for k in range(-5,6,1):
ak = compute_ak(x, T, omega0, k)
ak = sym.simplify(ak, rational=True) # Note: the ".simplify(rational=True)"
# simplifies the expression, without it the output looks
# very strange ¯\_(ツ)_/¯
a.append(ak)
print('a_{0}={1}'.format(k, ak))
a_-5=0
a_-4=0
a_-3=0
a_-2=0
a_-1=1/2
a_0=0
a_1=1/2
a_2=0
a_3=0
a_4=0
a_5=0
And \(y(t)\)’s coefficients:
b = []
for k in range(-5,6,1):
ak = compute_ak(y, T, omega0, k)
ak = sym.simplify(ak, rational=True)
b.append(ak)
print('b_{0}={1}'.format(k, ak))
b_-5=0
b_-4=0
b_-3=0
b_-2=0
b_-1=I/2
b_0=0
b_1=-I/2
b_2=0
b_3=0
b_4=0
b_5=0
Now we need to convolve \(a_k\) and \(b_k\) to find the answer:
import numpy as np
a = np.array(a)
b = np.array(b)
c = np.convolve(a,b, mode='same')
print(c)
[0 0 0 I/4 0 0 0 -I/4 0 0 0]
The answer indicates that \(c_{-2} = \frac{j}{2}\) and \(c_{2} = \frac{-j}{2}\). You can verify this by directly evaluating the analysis equation on \(z(t)\) (as descibed in 0601). We leave this as an exercise for the reader.
Related content:
Explore Fourier series representation for continuous time periodic signals.