Convolution of two complex exponentials#
Suppose that a CT LTI system is represented by the impulse response \(h(t)=e^{\lambda_2t}u(t)\). What would be the output of this system for input \(x(t)=e^{\lambda_1t}u(t)\)? The answer to this question is the convolution of \(h(t)\) and \(x(t)\):
\(y(t) = \int_{-\infty}^\infty e^{\lambda_1 \tau}u(\tau) e^{\lambda_2 (t-\tau)}u(t-\tau) d\tau = \frac{e^{\lambda_1t}-e^{\lambda_2t}}{\lambda_1-\lambda_2}u(t).\) Refer to Exercise 4.5 in the book for the intermediate steps.
Let us verify this result for \(\lambda_1=-2\) and \(\lambda_2=-5\) using Sympy.
import sympy as sym
t, tau = sym.symbols('t tau', real=True)
# input signal
x = sym.Piecewise((0, t<0),(sym.exp(-2*t), True))
# impulse response
h = sym.Piecewise((0, t<0),(sym.exp(-5*t), True))
# convolution
xtau = x.subs(t, tau)
htau = h.subs(t,tau)
y = sym.integrate(xtau*htau.subs(tau, t-tau), (tau, -sym.oo, sym.oo))
y
The expression above is equivalent to \(\frac{e^{-2t}-e^{-5t}}{-2+5} u(t)\). The plot of \(y(t)\) is shown below.
sym.plot(y, label=r'$y(t)$',legend=True);
You can visualize and compute the values of this convolution integral at specific \(t\) values using the following code. \(y(t)\) is the area under \(h(t-\tau)\) weighted by \(x(\tau)\). You can try different \(t\) values below.
import numpy as np
t=.5
print("For t =",t)
p1 = sym.plot(xtau, (tau, -2, 2), show=False, label=r'$x(\tau)$', legend=True)
p2 = sym.plot(htau.subs(tau,t-tau), (tau, -2, 2), show=False,
label=r'$h(t-\tau)$', legend=True)
p2.append(p1[0])
p2.show()
For t = 0.5
Related content:
Explore cross-correlation and auto-correlation.
A convolution (cross-correlation) example from machine learning.