Code covered by the BSD License  

Highlights from
Generation of PN sequence using polynomial

Generation of PN sequence using polynomial

by

Ashish Verma (view profile)

 

Generation of PN sequence using polynomial

Polynomail_pn.m
clc;
clear all;
%Enter the length of sequence
len=31; %'Enter  the length of sequence');
%Enter the polynomail
poly=[1 0 0 0 1 1];%'Enter the polynomail:');
%Enter initial state
ini= [1 0 0 0 0];%'Enter initial state:');
ff= log2(len+1); % find No flip flop for ex log(16+1)=4
% pn sequence genrator
a= zeros(len,ff); % create all possible combination zeroes
a(1,(1:ff))= ini% first row initial state
for i = 1:(len-1)
x = 0;
for j = 2:(ff+1)
if (poly (1,j) == 1)

 val=a(i,(j-1));
x = xor (x,a(i,(j-1)));
end

end
a ((i+1),1:ff) = circshift(a(i,1:ff),[0 1]);
a ((i+1),1) = x;
end
for i = 1:len
h(1,i) = a(i,ff);
end
disp(h)
m=h;
for i=1:len
m(i+1,:)=circshift(m(i,1:len),[0 1]);
end
disp(m)

    



Contact us