Correlation and Discrete Time Signals
Correlation and Discrete Time Signals
Experiment No.: 2
Date: 3 / 09 / 2021
Reg No : 19BEE0384
AIM:
1. To find the output cross and auto correlation and generate a graph
2. To compute and sketch the graph of a modulated discrete-time signal.
REQUIRED SOFTWARE:
1. Cross correlation
Clc;
clear all;
x=input('enter samples of x');
h=input('enter samples of h');
xlen=length(x);
hlen=length(h);
for i=1:xlen;
for j=1:xlen;
y(i,i+j-1)=x(i)*h(hlen-j+1);
end
end
z=sum(y);
disp('output');z
disp('output sequence');y
stem(x,y);
2.Auto correlation
clc
clear all;
x=input('enter samples of x');
xlen=length(x);
for i=1:xlen;
for j=1:xlen;
y(i,i+j-1)=x(i)*h(hlen-j+1);
end
end
z=sum(y);
disp('output');z
stem(x,y)
3. For 0≤n≤255 (Frequency analysis of amplitude modulated dicrete-time signal)
clc;
close all;
clear all;
f1=1/128; f2=5/128; fc=50/128; n=0:255;
x=cos(2*pi*f1*n)+cos(2*pi*f2*n);
xa=cos(2*pi*fc*n);
xamp=x.*xa;
subplot(2,2,1); plot(n,x); title('x(n)');
xlabel('n-->');ylabel('amplitude');
subplot(2,2,2); plot(n,xa); title('xa(n)');
xlabel('n-->'); ylabel('amplitude');
subplot(2,2,3); plot(n,xamp);
xlabel('n-->'); ylabel('amplitude');
clc;
close all;
clear all;
n=0:127; figure;n1=128;
f1=1/128; f2=5/128; fc=50/128;
x=cos(2*pi*f1*n)+cos(2*pi*f2*n);
xc=cos(2*pi*fc*n);
xa=cos(2*pi*fc*n);
xamp=x.*xa; xam=fft(xamp,n1);
stem(n,xam); title('xamp(n)');
xlabel('n-->'); ylabel('amplitude');
clc;
close all;
clear all;
n=0:99; figure; n1=128; n2=0:n1-1;
f1=1/128; f2=5/128; fc=50/128;
x=cos(2*pi*f1*n)+cos(2*pi*f2*n);
xc=cos(2*pi*fc*n);
xa=cos(2*pi*fc*n);
xamp=x.*xa;
for i=1:100
xamp1(i)=xamp(i);
end
xam=fft(xamp1,n1);
stem(n2,xam); title('xamp(n)');
xlabel('n-->'); ylabel('amplitude')
OUTPUT GRAPH:
1. Cross correlation
2. Auto correlation
3. DFT 0≤n≤255
4. DFT 0≤n≤127
5. DFT 0≤n≤99
The comparison of two independent time series to see if there is a correlation between metrics with the
same maximum and minimum values is known as cross-correlation.The comparing of a time series with
itself at a separate time is known as auto-correlation. It seeks to find recurrent patterns or seasonality,
for example. The experiment to generate the above-mentioned signals using MATLAB2020a was
performed successfully and the output was verified.