Robochameleon  v1.0
gen_prbs.m
Go to the documentation of this file.
1 
2 function x=gen_prbs(n)
3 
4 switch n
5  case 7
6  g = [7 6];
7  case 15
8  g = [15 14];
9  case 23
10  g =[23 18];
11  case 31
12  g = [31 28];
13  otherwise
14  error('Allowed lengths: 2^{7|15|23|31}-1');
15 end
16 
17 % PRBS Generation
18 z = zeros(1,2^n-1);
19 z(1)=1;
20 for i=(n+1):(2^n-1)
21  q=z(i-g(1));
22  for j=2:length(g)
23  q=xor(q,z(i-g(j)));
24  end
25  z(i) = q;
26 end
27 z = [z 0];
28 z=z(:);
29 x = logical(z(1:2^n-1));
30 
31 end
function gen_prbs(in n)
Generate PRBS sequence.