LAB1
Title: Discrete LTI Systems and Convolution
Student Name:
Reg. No. :
Date :
Signature :
Objectives:
1) Synthesis of signals using unit impulse signals
2) Graphical representation of convolution operation.
3) Writing our timing information convolution function.
4) Using convolution function in correlation operations.
Preparation: (10 mins)
A) What is meant by LTI systems? And prove that y = conv(x,y) in any LTI
systems where:
x ----> input signal
y ----> output signal
h ----> inpulse response signal
B) Create a new folder called LAB2
C) Open Matlab Program and switch the current directory to LAB2
Procedure:
Step 1: Open a new script file and write. (15 Minutes)
function [y,ny] = conv_m(x,nx,h,nh)
nyb = nx(1) + nh(1);
nye = nx(length(nx)) + nh(length(nh));
ny = (nyb : nye);
y = conv(x,h);
end
Save the file in current folder, LAB2, with the name conv_m.m
Try the following commands in command window and check the results:
x = [3 11 7 0 -1 4 2];
nx = -3:3;
h = [2 3 0 -5 2 1];
nh = -1:4;
[y,ny] = conv_m(x,nx,h,nh)
Q) Write down the value of y and its timing index ny?
Step2: Graphical representation of convolution operation. (15 Minutes)
Open a new script file and write
x = [1 1 1 1 1];
nx = [-2:2];
h = [1 1 1 1 1 ];
nh = [-2:2];
[y , ny] = conv_m(x,nx,h,nh);
subplot(3,1,1), stem(nx,x),title('x(n)');
subplot(3,1,2), stem(nh,h),title('h(n)');
subplot(3,1,3), stem(ny,y),title('y(n)');
Save the file in current folder, LAB2, with the name conv_rep.m
Q) Draw the signals x(k) & h(-k+n) for n = 0, -1, 1 and calculate y(0), y(-1), and y(1)?
Step3: Sequense correlations (15 Minutes):
it's an operation used in many applications of digital signal processing, it's a measure of the degree to
which two sequences are similar, given two finite energy signals x(n) and y(n), the correlation between
the two signal is defined as:
if we compare the convolution operation with the above equation of correlation, observe a close
relevance.
Radar Application example:
nx = 0:100;
f = 1e6;
fs = 10 * f ; % Sampling frequency Fs = 1 / Ts
t = nx * (1/fs); % time instants
x = cos(2.*pi.*f.* t);
subplot(3,1,1);
stem(nx,x), title('Transmitted Signal');
%%
[y,ny] = sigshift(x,nx,20); % shift by k = 20
w = randn(1,length(y)), nw = ny; % Noise
[y,ny] = sigadd(y,ny,w,nw);
subplot(3,1,2);
stem(ny,y), title('Received shifed and distorted signal');
%%
[x,nx] = sigfold(x,nx); % x(-n)
[rxy, nrxy] = conv_m(y,ny,x,nx); % Cross-correlation
subplot(3,1,3);
stem(nrxy,rxy), title('Correlation Result');
Homework:
1) After you have completed LAB2, you had the following Matlab function in LAB2 folder:
(conv_m), use it to obtain the following signal:
Let x(n) = 1 for 0<= n < 9
and h(n) = (0.9).^ n for 0<= n < 9
Calculate y(n) = x(n) * h(n) where * is a convolution operator