0% found this document useful (0 votes)
103 views8 pages

Digital Signal Processing Lab Exp 1: Correlation

1. The document describes generating single-tone and multi-tone signals in MATLAB and performing auto and cross-correlation. Auto-correlation of single signals x and y and multi-tone signal xm were computed. 2. Cross-correlation of x and y yielded a weak correlation coefficient near 0. Variation of the correlation coefficient r with frequency and amplitude was plotted for single and multi-tone signals. 3. For single-tone signals, r varied from -0.0069 to 1 with frequency and was constant at 1 with amplitude. For multi-tone signals, r varied between -0.0055 to 0.45 with frequency and was constant at 0.4084 with amplitude.

Uploaded by

Nandha Kizor V
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)
103 views8 pages

Digital Signal Processing Lab Exp 1: Correlation

1. The document describes generating single-tone and multi-tone signals in MATLAB and performing auto and cross-correlation. Auto-correlation of single signals x and y and multi-tone signal xm were computed. 2. Cross-correlation of x and y yielded a weak correlation coefficient near 0. Variation of the correlation coefficient r with frequency and amplitude was plotted for single and multi-tone signals. 3. For single-tone signals, r varied from -0.0069 to 1 with frequency and was constant at 1 with amplitude. For multi-tone signals, r varied between -0.0055 to 0.45 with frequency and was constant at 0.4084 with amplitude.

Uploaded by

Nandha Kizor V
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/ 8

108119070 NANDHA KIZOR V

DIGITAL SIGNAL PROCESSING LAB


EXP 1: CORRELATION
AIM:
1. To generate signals with different amplitude and frequencies
2. Generation of signals with multiple frequencies
3. Performing Auto and Cross correlation for different signals
4. Finding Correlation Coefficient
5. Study of correlation coefficients relationship with amplitude and frequencies
SOFTWARE USED: MATLAB
THEORY:
convolution of two continuous time signals which is used to find the output y(t) of a
system. Correlation is a mathematical operation that closely resembles convolution.
Correlation is basically used to compare two signals. Correlation is the measure of the
degree to which two signals are similar. The correlation of two signals is divided into two
ways: (i) Cross-correlation, (ii) Auto-correlation.
Correlation quantifies the ‘LINEAR’ relationship between two signals.
For Example: If we transmit a square wave, the receiver should ideally receive the same square
wave. Practically, due to noise in the channel, the received square wave will not be proper.

The Receiver will have a ‘CORRELATOR’ block to compare the incoming noisy-
square wave with an ideal square wave to determine whether the signal can be used for
decoding or to discard the incoming signal.
108119070 NANDHA KIZOR V

COEFFICIENT OF CORRELATION
It is denoted by ‘r’.
• If r = +1, it shows positive linear relationship
• If r = -1, it shows negative linear relationship
• If r= 0, there is no linear relationship

r Strength of Correlation

0 < |r| < 0.3 Weak Correlation


0.3 < |r| < 0.7 Moderate Correlation
|r| > 0.7 Strong Correlation

PROCEDURE:
• Take two signals x and y of amplitude 4.5, having same sampling frequency of 9*50 with
base band frequency satisfying the Nyquist rate.
• Generate x and y using Mat lab and plot it.
• Find auto correlation 𝑆𝑥𝑥, 𝑆𝑦𝑦 and cross correlation 𝑆𝑥𝑦 and plot it.
• Compute the Pearson’s correlation coefficient ‘𝑟’.
• Determine the strength of correlation using the ‘display’ command.
• Plot the variation of ‘𝑟’ with respect to frequency ‘f’ by varying the frequency of the Signal
y1
• Plot the variation of ‘𝑟’ with respect to amplitude ‘a’ by varying the amplitude of y2
• Repeat the above simulation steps by using a signal which has 2 or multiple frequencies i.e.
f1, f2…etc either in x1 or x2. (Variation of r with amplitude and frequency for multi tone
signal)
108119070 NANDHA KIZOR V

CODE:
%GENERATION AND CORRELATION OF SINGLE TONE SIGNALS
f1=900;
f2=1500;
fs=4000;
ts=1/fs;
t=0:ts:2*pi;
x=sin(2*pi*f1*t);
y=sin(2*pi*f2*t);
X=mean(x);
Y=mean(y);
sxx=sum((x-X).^2)
syy=sum((y-Y).^2)
sxy=sum((x-X).*(y-Y))
r=sxy/(sqrt(sxx*syy))
if (0<abs(r))&& (abs(r)<.3)
fprintf('Weak Co-relation\n')
elseif (0.3<abs(r))&& (abs(r)<.7)
fprintf('Moderate Co-relation\n')
else
fprintf('Strong Co-relation\n')
end
subplot(4,2,1);
plot(t,x);
xlabel('t');
ylabel('x(t)');
xlim([0 0.04]);
title('Single tone signal X');
subplot(4,2,2);
plot(t,y);
xlabel('t');
ylabel('y(t)');
xlim([0 0.04]);
title('Single tone signal Y');

%VARIATION OF r WITH FREQUENCY FOR SINGLE TONE SIGNAL


rf=[];
for f3=1:1500;
y1=sin(2*pi*f3*t);
syy1=sum((y1-mean(y1)).^2);
sxy1=sum((x-X).*(y1-mean(y1)));
r1=sxy1/sqrt(sxx*syy1);
rf=[rf r1];
end
subplot(4,2,5);
plot(rf);
xlim([0 1500]);
ylim([-0.05 1.05]);
xlabel('Frequency');
ylabel('Correlation Coefficient');
title('r vs f for single tone signal');
108119070 NANDHA KIZOR V

%VARIATION OF r WITH AMPLITUDE FOR SINGLE TONE SIGNAL


ra=[];
for a=1:10;
y2=a*x;
syy2=sum((y2-mean(y2)).^2);
sxy2=sum((x-X).*(y2-mean(y2)));
r2=sxy2/sqrt(sxx*syy2);
ra=[ra r2];
end
subplot(4,2,6);
plot(ra);
xlim([0 10]);
ylim([-2 2]);
xlabel('Amplitude');
ylabel('Correlation Coefficient');
title('r vs a for single tone signal');

%GENERATION AND CORRELATION OF A MULTITONE SIGNAL


xm=x+2*sin(2*pi*1700*t);
sxxm=sum((xm-mean(xm)).^2)
subplot(4,2,3);
plot(t,xm);
xlabel('t');
ylabel('xm(t)');
xlim([0 0.06]);
title('Multi tone signal');

%VARIATION OF r WITH FREQUENCY FOR MULTI TONE SIGNAL


rfm=[];
for f4=1:1500;
y3=sin(2*pi*f4*t);
syy3=sum((y3-mean(y3)).^2);
sxy3=sum((xm-mean(xm)).*(y3-mean(y3)));
r3=sxy3/sqrt(sxxm*syy3);
rfm=[rfm r3];
end
subplot(4,2,7);
plot(rfm);
ylim([-0.05 1.05]);
xlim([0 1500]);
xlabel('Frequency');
ylabel('Correlation Coefficient');
title('r vs f for multi tone signal');

%VARIATION OF r WITH AMPLITUDE FOR MULTI TONE SIGNAL


ram=[];
for am=1:10;
y4=am*x;
syy4=sum((y4-mean(y4)).^2);
sxy4=sum((xm-mean(xm)).*(y4-mean(y4)));
r4=sxy4/sqrt(sxxm*syy4);
ram=[ram r4];
end
subplot(4,2,8);
plot(ram);
ylim([-2 2]);
xlabel('Amplitude');
ylabel('Correlation Coefficient');
title('r vs a for multi tone signal');
108119070 NANDHA KIZOR V

RESULTS:
1. Two single tone signals x and y were generated.
𝑥 = sin(1800𝜋𝑡)
𝑦 = sin(3000𝜋𝑡)

Auto correlation function of signal x 𝑆𝑥𝑥 = 1.2566*10^4


Auto correlation function of signal y 𝑆𝑦𝑦 = 1.2566*10^4
Cross correlation function of signals x and y 𝑆𝑥𝑦 = -0.3894
Pearson’s correlation coefficient 𝑟 = -3.0987*10^-5
The correlation was observed to be ‘weak’.
108119070 NANDHA KIZOR V

2. A multitone signal xm was generated.


Given: x1 is a signal composed of a sinusoid of amplitude 1 and frequency 0.9KHz (same as
x) and a sinusoid of amplitude 2 and frequency of 1.7KHz
𝑥𝑚 = 𝑥 + 2sin(2𝜋*1700𝑡) = sin(2𝜋*900t) + 2sin(2𝜋*1700𝑡)

Auto correlation function of signal xm 𝑆𝑥𝑥𝑚 = 2.5133*10^4

3) Variation of Pearson’s correlation coefficient ′𝑟′ with frequency and amplitude for a single
tone signal was observed graphically.
i. Variation of 𝑟 with frequency for a single tone signal
On varying frequency from 1 Hz to 1500 Hz value of 𝑟 ranges from -0.0069 to 1
The peak value of 1 was obtained at frequency 900 Hz
108119070 NANDHA KIZOR V

ii. Variation of 𝑟 with amplitude for a single tone signal


On varying frequency from 1 to 900 units, constant 𝑟 value of 1 was obtained.

4) Variation of Pearson’s correlation coefficient ′𝑟′ with frequency and amplitude for a multi
tone signal was observed graphically.
i. Variation of 𝑟 with frequency for a multi tone signal
On varying frequency from 1 Hz to 1500 Hz value of 𝑟 ranges from -0.0055 to 0.45
The peak value of 0.45 was obtained at frequency 900 Hz
108119070 NANDHA KIZOR V

ii. Variation of 𝑟 with amplitude for a multi tone signal


On varying frequency from 1 to100 units, constant 𝑟 value of 0.4084 was obtained.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy