Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1
Date: 1/8/19
REALIZATION OF CORRELATION
AIM:
1. Generation of signals with different amplitude and frequencies.
2. Generation of signals with multiple frequencies.
3. Performing auto and cross correlation of different signals.
4. Finding the correlation coefficient.
5. Study of correlation coefficient relationship with amplitude and frequencies.
THEORY:
Correlation quantifies the ‘linear’ relationship between two signals. It is a measure of the similarity
between two signals.
There are two types of correlation:
• Auto Correlation
• Cross Correlation
Auto Correlation is defined as correlation of a signal with itself. Auto correlation function is a measure
of similarity between a signal & its time delayed version.
Auto Correlation function of signal x 𝑆𝑥𝑥 where X is the mean value of signal x
Auto Correlation function of signal y 𝑆𝑦𝑦 where Y is the mean value of signal y
Cross correlation is the measure of similarity between two different signals.
Pearson’s Coefficient of Correlation (denoted by ‘𝑟’) shows the linear relationship between two sets of
data. It is defined as the covariance of the two variables divided by the product of their standard
deviations.
𝑆𝑥𝑦
𝑟=
√𝑆𝑥𝑥𝑆𝑦𝑦
• Take two signals x and y of amplitude 1, having same sampling frequency of 10KHz with base
band frequency satisfying the Nyquist rate.
• Generate x1 and y1 using Mat lab and plot it.
• Find auto correlation 𝑆𝑥𝑥, 𝑆𝑦𝑦 and cross correlation 𝑆𝑥𝑦 and plot it.
• Compute the Pearson’s correlation coefficient ‘𝑟’.
• Plot the variation of ‘𝑟’ with respect to frequency ‘f’ by varying the frequency of any one of the
signal. • Plot the variation of ‘𝑟’ with respect to amplitude ‘a’ by varying the amplitude of any
one of the signal.
• Determine the strength of correlation in each of the above cases using the ‘display’ command.
• 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.
• Finally write the inferences.
MATLAB CODE:
%GENERATION AND CORRELATION OF SINGLE TONE SIGNALS
f1=100; f2=200; fs=10000; 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))
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(200𝜋𝑡)
𝑦 = sin(400𝜋𝑡)
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 400 Hz value of 𝑟 ranges from -0.0069 to 1
The peak value of 1 was obtained at frequency 100 Hz
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 400 Hz value of 𝑟 ranges from -0.0055 to 0.8166
The peak value of 0.8166 was obtained at frequency 200 Hz
Two smaller peaks are obtained at frequencies 100 Hz and 300 Hz
ii.
Variation of 𝑟 with amplitude for a multi tone signal
On varying frequency from 1 to100 units, constant 𝑟 value of 0.4084 was obtained.