Digital Signal Processing Lab Exp 1: Correlation
Digital Signal Processing Lab Exp 1: Correlation
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
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');
RESULTS:
1. Two single tone signals x and y were generated.
𝑥 = sin(1800𝜋𝑡)
𝑦 = sin(3000𝜋𝑡)
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
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