Convolution
Convolution
Convolutions
Objectives
• To understand the convolution of signals in MATLAB.
Y (ω) = X(ω)H(ω)
The Discrete-Time Fourier Transform (DTFT) of x[n] is X(ejω ) and for h[n] is H(ejω ).
Applying the DTFT to both sides:
( ∞ )
X
Y (ejω ) = DTFT{y[n]} = DTFT x[k]h[n − k]
k=−∞
1
MATLAB Code for Discrete-Time Convolution
1 dt = 0.01;
2 t1 = -1: dt :1;
3 x = ones (1 , length ( t1 ) ) ;
4 subplot (3 , 1 , 1) ;
5 plot ( t1 , x ) ;
6 title ( ’x ( t ) ’) ;
7 xlabel ( ’t ’) ;
8 ylabel ( ’x ( t ) ’) ;
9
10 t2 = -1: dt :1;
11 h = ones (1 , length ( t2 ) ) ;
12 subplot (3 , 1 , 2) ;
13 plot ( t2 , h ) ;
2
14 title ( ’h ( t ) ’) ;
15 xlabel ( ’t ’) ;
16 ylabel ( ’h ( t ) ’) ;
17
18 % Perform the convolution
19 y = conv (x , h ) * dt ;
20 ys = t1 (1) + t2 (1) ;
21 yt = ys + (0: length ( y ) - 1) * dt ;
22 subplot (3 , 1 , 3) ;
23 plot ( yt , y ) ;
24 title ( ’ Convolution ␣ y ( t ) ’) ;
25 xlabel ( ’t ’) ;
26 ylabel ( ’y ( t ) ’) ;
Discussion
In this lab, we analaysed the convolution theorem for discrete time convolution and continuous
time convolution. We convoluted two discrete time signals. We entered the two sequence as
[1,-1,3,1,1] and convoluted the signal with another signal h(τ ) as [1,1,1,1]. We advanced the
signal by 1 sec and showed the convolution in MATLAB(Figure 1). Similarly, the convolution
for continuous time signal is shown. To get the unit step signal, we didn’t use any function but
rather we decreased the time value and at each point assigned it to 1. The convolution was
performed as shown in the Figure 2 in MATLAB and the output was shown to be t − 2 to 2 − t
which matched the theoretical convolution performed in class.
Conclusion
Hence the convolution of discrete time signals and continuous time signals was performed.
3
Figure 2: Continuous Time Convolution