Azhar Sayyed Ss

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 4

EXPERIMENT NO 06 : EXPLANATION

ILLUSTRATE OF CROSS CORRELATION AND AUTO CORRELATION

PROGRAMME 1 : CROSS CORRELATION

EXAMPLE 1:

Given x(n)and y(n), find cross corelation

>>x=[ 1 2 -3 -2 4];

>> y=[-2 3 1 -1 3];

>> r=conv(x,fliplr(y))

r=

3 5 -10 2 15 -19 4 16 -8

>> n=0:8;

>> stem(n,r)

>> xlabel('Time index n')

>> ylabel('Amplitude')

>> title('Cross Correlation')


Cross Correlation
20

15

10

5
Amplitude

-5

-10

-15

-20
0 1 2 3 4 5 6 7 8
Time index n

EXAMPLE 2:

x=[1 -2 3 -4 5];

y=[1 0 2 3 4];

>> r=conv(x,fliplr(y))

r=

4 -5 8 -11 15 5 13 -4 5

>> n=0:8;

>> stem(n,r)

>> xlabel('Time index n')

>> ylabel('Amplitude')
>>title('Cross Correlation')

Cross Correlation
15

10

5
Amplitude

-5

-10

-15
0 1 2 3 4 5 6 7 8
Time index n

PROGRAMME 2: AUTO CORRELATION

x=[1 -2 3 -4 5]

x=

1 -2 3 -4 5

>> r=conv(x,fliplr(x))

r=
5 -14 26 -40 55 -40 26 -14 5

>> n=0:8;

>> stem(n,r)

>> xlabel('Time index n')

ylabel('Amplitude')

>> title('Auto correlation')

Auto correlation
60

50

40

30

20
Amplitude

10

-10

-20

-30

-40
0 1 2 3 4 5 6 7 8
Time index n

You might also like