clear;clc;close all;
e1 = [1 1 -1 1 -1 -1 1];
e2 = [1 1 -1 -1 1 -1 1];
e3 = [1 1 -1 1 1 -1 1];Lc = 7;fonsiz = 18;
e4 = [1 1 -1 -1 1 1 -1];esel1 = e4;esel2 = e4;
for i = 1:numel(esel1)
    corrvec(i) = esel1 * [esel2(i:end) esel2(1:i-1)]';
end
plot(0:numel(esel1)-1,corrvec/Lc,'-r','LineWidth',3);
set(gcf,'Color',[1 1 1]);set(gca,'FontSize',fonsiz)
xlabel('Time ( in increments of \itT_c\rm\bf )','FontSize',fonsiz,'FontWeight','bold');
ylabel('\it\bfR_e , \rm\bfautocorrelation for PN sequence  \it\bfe\rm\bf_4','FontSize',fonsiz,'FontWeight','bold')
axis ([0 6 min(corrvec/Lc)*1.05 max(corrvec/Lc)*1.05]);