SnS Lab 4
SnS Lab 4
Objectives:
• Familiarizing students with implementation of LTI systems in MATLAB
Equipment required:
• MATLAB installed on PCs
Background Knowledge:
Convolution of Continuous-Time Signals:
Convolution is a mathematical operation that describes the action of a linear system on a signal. The impulse
response of a linear time-invariant system completely specifies the system. More specifically, if the impulse
response of a system is known one can compute the system output for any input signal. The output of a
system to any input signal is computed by the convolution of the input signal with the impulse response of
the system. Suppose 𝑦(𝑡) denotes the output of the system, 𝑥(𝑡) is the input signal and ℎ(𝑡) is the impulse
response of the system. The mathematical expression of the convolution relationship is:
𝑦(𝑡) = 𝑥(𝑡) ∗ ℎ(𝑡)
where, * is the symbol for convolution. The convolution between two continuous-time signals involves the
computation of an integral. The convolution integral is written as:
+∞
𝑦(𝑡) = 𝑥(𝑡) ∗ ℎ(𝑡) = ∫ 𝑥(𝜏) ∗ ℎ(𝑡 − 𝜏)𝑑𝜏
−∞
Convolution in MATLAB:
‘conv’ is the built- in function in MATLAB that convolves LTI systems and returns the result of this
convolution. y = conv(x,h) returns the convolution of vectors x and h. The resulting vector is of length:
𝐿𝑒𝑛𝑔𝑡ℎ(𝑦) = 𝐿𝑒𝑛𝑔𝑡ℎ(𝑥) + 𝐿𝑒𝑛𝑔𝑡ℎ(ℎ) − 1
Since convolution is commutative, convolving ‘x’ with ‘h’ or convolving ‘h’ with ‘x’ will evaluate similar
results.
Deconvolution of Continuous-Time Signals:
If ℎ(𝑡) (impulse response of a system) and 𝑦(𝑡) (output of a system) are available, then the input signal
𝑥(𝑡) that was applied to the system can be retrieved. This process is called deconvolution and is
implemented in MATLAB using the command ‘deconv’. Deconvolution is useful in determining the
impulse response of a system if the input and output signals are known. The command to find the response
of system is h = deconv(y,x).
The ‘deconv’ command does not follow commutative property; hence, the output signal must be the first
input argument of the command ‘deconv’.
Convolution of Discrete-Time Signals:
Convolution of discrete-time signals essentially follows the same steps as the continuous-time convolution.
Suppose 𝑦[𝑛] denotes the output of the system, 𝑥[𝑛] is the input signal and ℎ[𝑛] is the impulse response of
the system. The mathematical expression of the convolution relationship is:
𝑦[𝑛] = 𝑥[𝑛] ∗ ℎ[𝑛]
The convolution between two discrete-time signals involves a summation. The convolution summation is
written as:
+∞
The discrete-time convolution sum is analytically calculated by following the steps given below:
Step 3 Obtain the reversed sequence h[-k], and align the rightmost element of h[n-k] to the leftmost
element of x[k]
Step 4 Multiply and sum the overlapping non-zero terms to get y[n]
Step 6 Repeat step 4; stop if all the output values are zero or when you get the result
The ‘conv’ command in MATLAB is used to convolve two discrete-time signals, much as we convolve
two continuous-time signals. The deconvolution is also performed in the same way using ‘deconv’
command.
Properties of Convolution:
Mathematical properties of convolution are given below:
• Commutative
𝑥(𝑡) ∗ ℎ(𝑡) = ℎ(𝑡) ∗ 𝑥(𝑡)
• Associative
𝑥(𝑡) ∗ {ℎ1 (𝑡) ∗ ℎ2 (𝑡)} = {𝑥(𝑡) ∗ ℎ1 (𝑡)} ∗ ℎ2 (𝑡)
• Distributive
𝑥(𝑡) ∗ {ℎ1 (𝑡) + ℎ2 (𝑡)} = 𝑥(𝑡) ∗ ℎ1 (𝑡) + 𝑥(𝑡) ∗ ℎ2 (𝑡)
Lab Tasks:
1. Suppose that a linear time-invariant system is described by impulse response ℎ[𝑛] = 2𝑛 ∗ 𝑢[𝑛].
Compute response of the system to the input signal 𝑥[𝑛] = 𝑢[𝑛 + 10] − 𝑢[𝑛 − 5] for 𝑛 =
−15: 15.
Hint: (𝑢[𝑛] is the unit step function. Use the ‘conv’ function for computing the convolution of the
given signals and use subplot() command to plot 𝑥[𝑛], ℎ[𝑛] and 𝑦[𝑛].
2. Suppose that impulse response of a system is:
𝑒 −𝑛 , −10 ≤ 𝑛 ≤ 10
ℎ[𝑛] = {
0, 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Find the output y[n] when n=-15:15. Use subplot command to plot 𝑥[𝑛], ℎ[𝑛] and 𝑦[𝑛].
4. Verify all the mathematical properties of convolution integral for the following signals:
𝑥[𝑛] = 𝑒 −2𝑛 ∗ 𝑢[𝑛 − 10]
ℎ1 [𝑛] = 2−𝑛 ∗ 𝑢[𝑛 + 3]
ℎ2 [𝑛] = 0.3𝑛 ∗ 𝑢[𝑛 − 5]
Use subplot command to plot 𝑥[𝑛], ℎ1 [𝑛], ℎ2 [𝑛], LHS and RHS results of each property.