0% found this document useful (0 votes)
162 views4 pages

LAB-05 EE-311 Signal and Systems PDF

The document is a lab manual for computing convolution and correlation of signals in MATLAB. It contains: 1) An objective to study convolution and correlation using MATLAB. 2) Details on convolution, which determines a system's output from the input and impulse response using the convolution integral. 3) Details on correlation, which measures the similarity between two signals as a function of their time shift and can be autocorrelation or cross-correlation. 4) A homework task to plot and comment on the cross-correlation of two signals.

Uploaded by

Awais Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views4 pages

LAB-05 EE-311 Signal and Systems PDF

The document is a lab manual for computing convolution and correlation of signals in MATLAB. It contains: 1) An objective to study convolution and correlation using MATLAB. 2) Details on convolution, which determines a system's output from the input and impulse response using the convolution integral. 3) Details on correlation, which measures the similarity between two signals as a function of their time shift and can be autocorrelation or cross-correlation. 4) A homework task to plot and comment on the cross-correlation of two signals.

Uploaded by

Awais Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

The Islamia University of Bahawalpur

University College of Engineering &Technology


Department of Electronic Engineering
LAB MANUAL SIGNALS AND SYSTEMS EE-311 5thSemester

LAB EXPERIMENT # 05
Computing convolution & correlation of signals in MATLAB

Student Name: Abdul Rehman Roll No: 16ES08

Lab Instructor Signatures: Date:

OBJECTIVE:
To study convolution & correlation using MATLAB

1. Convolution:

A linear, time-invariant system h {.} is completely characterized by its impulse response.


h (t)=T{δ(t)}. Convolution determines the system's output from knowledge of the input and the
system's impulse response. This will result in the convolution integral and its properties

A discrete time LTI system is completely characterized by its impulse response

Where h[n] is impulse response of LTI systems where is applied to the system above equation is
the convolution sum in DT Signal i.e.
Code:
clc; clear all; close all;
figure (1); % Create figure window and make visible on screen
x = inline('1.5*sin(pi*t).*(t>=0 & t<1)');
h = inline('1.5*(t>=0&t<1.5) - (t>=2&t<2.5)');
dtau = 0.005; tau = -1:dtau:4;
ti = 0; tvec = -.25:.1:3.75;
y = NaN*zeros(1, length (tvec)); % Pre-allocate memory
for t = tvec,
ti = ti+1; % Time index
xh = x(t-tau).*h(tau); lxh = length(xh);
y(ti) = sum(xh.*dtau); % Trapezoidal approximation of interal
subplot (2,1,1);
plot(tau, h(tau), 'k-', tau, x(t-tau), 'k--', t, 0, 'ok');
axis([tau(1) tau(end) -2.0 2.5]);
patch([tau(1:end-1);tau(1:end-1); tau(2:end); tau(2:end)],...
[zeros(1,lxh-1);xh(1:end-1);xh(2:end);zeros(1,lxh-1)],...
[.8 .8 .8],'edgecolor', 'none');
xlabel('\tau');
legend('h(\tau)', 'x(t-\tau)','t ', 'h(\tau) x (t-\tau)','southwest');
c = get(gca, 'children'); set (gca, 'children', [c(2); c(3); c(4);
c(1)]);
subplot (2, 1, 2), plot (tvec, y, 'k', tvec (ti), y(ti), 'ok');
xlabel ('t'); ylabel ('y(t) = \int h(\tau)x(t-\tau) d\tau');
axis ([tau(1) tau(end) -1.0 2.0]); grid;
drawnow;
end;

Output:
2. Correlation:

Correlation is a measure of the similarity between two signals as a function to time shift
between them. Correlation is a maximum when two signals are similar in shape, and are in
phase.
Correlation can be characterized in two types a)
Autocorrelation
b) Cross-correlation

Autocorrelation is a mathematical tool used frequently in signals processing for analyzing


function or series of values, such as time domain signals. Informally, it is measure of how well a
signal matches a time-shifted version of itself, as a function of the amount of time shift.

Cross-correlation (or sometimes “cross-covariance”) is a measure of similarity of two signals,


commonly used to find features in an unknown signal by comparing it to a known one.

Homework Tasks:

1. Plot the cross-correlation of the following signal attach output graph comment on final
result:

• y( n )= x( n ) + w( n )
• x( n )= sin( f t ) with f1= 1 Hz
Where w(n) is a zeros mean, unit variance of Gaussian random process
x=[1 2 2 1 2];
nx=[-2:2]; % define sequence x[n] and its range h=[2
2 -1 1 2 2 1];
nh=[-3:3]; % define sequence h[n] and its range
nmin=min(nx)+min(nh); % specify the lower bound of convolved
sequences nmax=max(nx)+max(nh); % specify the upper bound of
convolved sequences subplot(311) stem(nx,x,'filled','m');
title('x(n)')
subplot(312)
stem(nh,h,'filled','r') axis([-4.5
4.5 -2 3])
title('h(n)')
y=conv(x,h);
n=[nmin:nmax]; % compute convolution and spec its
range subplot(313) stem(n,y,'filled');
grid on; % plot the resulting sequence y[n]
title('convolution of two sequence') % add title to the plot
ylabel('y[n]=x[n]*h[n]') % label the y-axis xlabel('index,[n]')
% label the horizontal axis

Output:

You might also like