0% found this document useful (0 votes)
28 views3 pages

Auto Co Relation

Uploaded by

luckykukki
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)
28 views3 pages

Auto Co Relation

Uploaded by

luckykukki
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/ 3

E1112 A03 Auto correlation Code:

clc; clear all; close all; m= input('enter input sequence'); a= input('enter starting point'); l1=length(m); n=[-a:-a+l1-1]; l=-n; disp(m); disp(n); disp(l); stem(l,m); a=length(m); b=length(l); x=[m zeros(1,b)]; h=[l zeros(1,a)]; y= zeros(a+b-1); for i=1:a+b-1 y(i)=0 for j=1:i if(j<i+1) y(i)=y(i)+x(j)*h(i-j+1) end end end t=[-a:-a+l1-1]; stem (y);

Command: enter input sequence[3 4 2 2 5 4] enter starting point-3 output:

-20

-40

-60

-80

-100

-120

10

11

Cross correlation: Code:


clc; clear all; close all; m= input('enter first input sequence'); n= input('enter second input sequence'); a= input('enter starting point of 1st sequence'); b= input('enter starting point of 2nd sequence'); l1=length(m); l2=length(n); p=[-a:-a+l1-1]; q=[-b:-b+l2-1]; p=-p; disp(m); disp(n); disp(p); stem(p,m); w=length(p); x=[m zeros(1,w)]; h=[p zeros(1,l1)]; y= zeros(l1+w-1); for i=1:l1+w-1

y(i)=0 for j=1:i if(j<i+1) y(i)=y(i)+x(j)*h(i-j+1) end end end t=[-a:-a+l1-1]; stem (y);

Command: enter first input sequence[1 2 4 2 5 6] enter second input sequence[3 5 4 1 3 6] enter starting point of 1st sequence-1 enter starting point of 2nd sequence-3 output:

0 -10 -20 -30 -40 -50 -60 -70 -80

10

11

You might also like