You are on page 1of 5

Bangladesh University of Business & Technology

(BUBT)

LAB REPORT
Course Title: Digital Signal Processing Lab

Course Code: EEE 314

Experiment no: 07

Experiment Name :Discrete-time Correlation.

Submitted By: Submitted To:


Name: Abid Hasan Name:Asiful Hoque

ID No:19202208023

Intake:29 Department of: EEE

Section:01 Bangladesh University of Business &

Program: BSC in EEE Technology.

Date of Submission: Signature of Teacher:


Experiment No: 07

Name of the Experiment: Discrete-time Correlation


Objective: The objectives of this experiment are to:
➢ Learn about correlation operations and their properties and purposes.
➢ Calculate autocorrelation and cross-correlation of signals using
MATLAB.
➢ Learn about some real-world application of correlation and simulate them
in the LAB.
Experiment Platfrom : MATLAB 2019
Code:
Problem 1 :
clc
clear all
nx = 0:399;
x = repmat([ones(1,40) zeros(1,40)],[1,5]);
subplot(3,1,1)
stem(nx,x)
nh=0:25;
h=0.25*0.75.^nh;
subplot(3,1,2)
stem(nh,h)
[y,ny] = correlation(x,nx,h,nh);
subplot(3,1,3)
stem(ny,y)

Graph:

Figure: 01
Problem 2 :
clc
clear all
close all
n1=0;
n2=120;
[d1,nn]=delta(n1,n2,0)
[d2,nn]=delta(n1,n2,40)
[d3,nn]=delta(n1,n2,70)
[d4,nn]=delta(n1,n2,80)
[s1,n1]=signaladd(d1,nn,2*d2,nn)
[s2,n2]=signaladd(2*d3,nn,d4,nn)
[s,nx]=signaladd(s1,n1,s2,n2)
subplot(311)
stem(nx,s)
nh=0:24;
h=(0.95).^nh;
subplot(312)
stem(nh,h)
[y,ny]=correlation(s,nx,h,nh);
subplot(313) stem(ny,y)

Delta Function:
function[delta,n]=delta(n1,n2,n0)
n=n1:n2; delta=n>=n0;
end
Signaladd Function:
function[sum,n]=signaladd(x1,n1,x2,n2)
n=min(min(n1),min(n2)):max(max(n1),max(n2));
y1=zeros(1,length(n)); y2=y1;
y1((n>=min(n1))& (n<=max(n1)))=x1;
y2((n>=min(n2))& (n<=max(n2)))=x2;
sum=y1+y2;
end

Function of correlation:
function[Rxy,n]=c(x1,n1,x2,n2)
[Rxy,n]=xcorr(x1,x2)
end
Graph:

Figure: 2
Comment:
1. Submit the complete data sheet with the screenshots of MATLAB code
and Output Graphs.

2. Using various variables value complete the data table, observe the output
graphs and write a report.

Discussion:

In this lab we have learn about correlation operations and their properties and
purposes.Also learn about the autocorrelation and cross-correlation of signals
using MATLAB.
To create these signals we have used some funcition file.Along with the
function file the code was executed and captured the output graph.

You might also like