You are on page 1of 1

%Bit length of the shiftRegister

shiftRegLength = 7;
%Start value of the shiftReg
shiftReg = round(rand(1,shiftRegLength));
%Generate output
%Note that this only has length 2^n-1 before it starts repeating
for i = 1:2^shiftRegLength-1
%Pull the output of the register (the last bit)
outputSeq(i)= shiftReg(shiftRegLength);
%Feedback (modulo 2) as implemented on pg 351 of Skolnik
c = xor(shiftReg(shiftRegLength),shiftReg(shiftRegLeng th-1));
%Insert that value in the beginning and shift the rest to the right
shiftReg = [c shiftReg(1:shiftRegLength-1)];
end
%Check to see how uncorrelated the output is.
plot(xcorr(outputSeq,outputSeq))

You might also like