Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

%correlation%

x=[1 1 1];
m=length(x);
m1=m-1;
x=[x,zeros(1,m1)];
disp(x);

n=length(x);
x1=zeros(n,n);
for i = 1:n
if(i==1)
for j = 1:n
x1(i,j)=x(j);
end
end
if(i>1)
x=[x(n),x(1:n-1)];
x1(i,1:n)=x(1:n);
end
end
x1=x1';

%os method%
y=[1 2 3 4 5 6];
n1=length(y);
y=[zeros(1:m1),y,zeros(1,10)];
disp(y);
z=zeros(1,n1);
h=zeros(n);
r=zeros(n,n);
st=1;
sto=5;
for i = 1:m
z=y(st:sto);
if(z==0)
break
else
h=z(1:length(z));

end
disp(h);
disp(x1*h');
st=st+3;
sto=sto+3;
end
%oa method%
h=[1 0 0 1 1 ; 1 1 0 0 1; 1 1 1 0 0;0 1 1 1 0; 0 0 1 1 1];
x=[1 2 3 4 5 6 ];
h1=[1 1 1];
l=length(x);
m=length(h1);
k=ceil(l/m)+1;
disp(k);
x1=zeros(1,k+m-1);
s=1;
st=k;
for i = 1:k-1
x1(1:k)=x(s:st);
disp(x1);
disp(h*x1');

st=st+k;
s=s+k;
end

You might also like