Auto Co Relation
Auto Co Relation
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);
-20
-40
-60
-80
-100
-120
10
11
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:
10
11