clear all
set(0,'defaultaxesfontsize',20);
% N=10;
% lag=[-N:N];
% bark1=[1 1 1 -1 -1 1 -1 0 0 0 0];
% r11=conv(bark1,conj(bark1(end:-1:1)));
% figure(1)
% set(gca,'FontSize',20);
% stem(lag,r11,'Linewidth',3)
% xlabel('Lag Value')
% %
% bark2=[0 1 1 1 -1 -1 1 -1 0 0 0];
% r22=conv(bark2,conj(bark2(end:-1:1)));
% figure(2)
% set(gca,'FontSize',20);
% stem(lag,r22,'Linewidth',3)
% xlabel('Lag Value')
% %
% bark3=[0 0 1 1 1 -1 -1 1 -1 0 0];
% r33=conv(bark3,conj(bark3(end:-1:1)));
% figure(3)
% set(gca,'FontSize',20);
% stem(lag,r33,'Linewidth',3)
% xlabel('Lag Value')
% %
% bark4=[0 0 0 1 1 1 -1 -1 1 -1 0];
% %bark5=[0 0 0 1 1 1 -1 1 0 0 0];
% r44=conv(bark4,conj(bark4(end:-1:1)));
% figure(4)
% set(gca,'FontSize',20);
% stem(lag,r44,'Linewidth',3)
% xlabel('Lag Value')
% %
% lagCT=[-4*7+1:4*7-1];
% bark=[1 1 1 -1 -1 1 -1];
% r55=conv(bark,conj(bark(end:-1:1)));
% barkCT=kron(bark,ones(1,4));
% r77=conv(barkCT,conj(barkCT(end:-1:1)));
% figure(5)
% set(gca,'FontSize',18);
% plot(lagCT,r77,'Linewidth',3)
% xlabel('Lag Value')
% %
% % ryx=conv([2 -1],r55);
% % w0=pi/3;
% % x=exp(j*w0*[0:10]).*[1 1 1 -1 -1 1 -1 0 0 0 0];
% % rxx=conv(x,conj(x(end:-1:1)));
% % ryy=exp(j*w0*lag).*r11;
% % x=cos(w0*[0:10]).*[1 1 1 -1 -1 1 -1 0 0 0 0];
% % rxx=conv(x,conj(x(end:-1:1)));
% % ryy=0.5*cos(w0*lag).*r11;
% % normd=norm(rxx-ryy)
% % [rxx' ryy']
% pause
x3=[1 1 -1];
x4=[1 1 -1 1];
x4_2=[1 1 1 -1];
x5=[1 1 1 -1 1];
x7=[1 1 1 -1 -1 1 -1];
x11=[1 1 1 -1 -1 -1 1 -1 -1 1 -1];
x13=[1 1 1 1 1 -1 -1 1 1 -1 1 -1 1];
rb3=conv(x3,conj(x3(end:-1:1)));
rb4=conv(x4,conj(x4(end:-1:1)));
rb4_2=conv(x4_2,conj(x4_2(end:-1:1)));
rb5=conv(x5,conj(x5(end:-1:1)));
rb7=conv(x7,conj(x7(end:-1:1)));
rb11=conv(x11,conj(x11(end:-1:1)));
rb13=conv(x13,conj(x13(end:-1:1)));
figure(1)
set(gca,'FontSize',18);
stem([-2:2],rb3,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 3')
figure(2)
set(gca,'FontSize',18);
stem([-3:3],rb4,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 4, 1st')
figure(3)
set(gca,'FontSize',18);
stem([-3:3],rb4_2,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 4, 2nd')
figure(4)
set(gca,'FontSize',18);
stem([-4:4],rb5,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 5')
figure(5)
set(gca,'FontSize',18);
stem([-6:6],rb7,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 7')
figure(6)
set(gca,'FontSize',18);
stem([-10:10],rb11,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 11')
figure(7)
set(gca,'FontSize',18);
stem([-12:12],rb13,'Linewidth',3)
xlabel('Lag Value')
title('rxx for Barker Code of length 13')
% h=[0 0 0 0 2 -1];
% y1=conv(h,rb5)
% y2=conv(h,rb7)
% y=y1+y2


