[email protected] m Sequence concept m Sequence is the abbreviation of the longest linear shift register . seeing the name of...">

当前位置:网站首页>Matlab simulation of m-sequence

Matlab simulation of m-sequence

2022-06-25 12:37:00 haoming Hu

author:haomingHu
email:[email protected]

m Sequence concept

m Sequence is the abbreviation of the longest linear shift register . seeing the name of a thing one thinks of its function ,m The sequence is made up of multiple shift registers , if N Is the number of shift registers ,n Stage shift registers share 2^n Status , Remove all 0 There's no more than that 2^n-1 States , produce m The linear feedback shift register of a sequence is called the longest linear shift register . produce m The circuit structure of sequence shift register , Its feedback line connection is not random ,m The period of the sequence Р You can't take any value , And you have to meet p=2”-1, In style ,n Is the number of shift registers .

The representation of code sequence is generally represented by characteristic polynomial and structure diagram , as follows :
4 and 5 Indicates that the values of the two registers are modulo-2 plus ,
 Insert picture description here

Module two plus : Same as 0, Dissimilarity is 1, It's equivalent to doing XOR

m Sequence generation process

 Insert picture description here
In general, the values of initialization registers are all 1
Program :

r=5;  % Specifies the number of register bits , That's for sure m The length of the sequence 
g=1*ones(1,r)  // initialization 
for k=1 :(2^r-1)
    out(k)=g(r);%%%out
    tmp = xor(g(r-1),g(r));% XOR the last two digits 
    g(2:r)=g(1:r-1);
    g(1)=tmp;% Put the last bit of the register to the first bit , Make the next shift 
end

a key : If it is stipulated that 1 Is a high level ,0 Is a low level , Then we must not use multiplication to do modulo two addition , Because if both are 1 Under the circumstances , The result of multiplication is 1, But the result should be 0, So if you want to add modulo two by multiplication , Then it must be specified that the high level is -1, The level is 0, This is the time -1*1 = -1 explain -1 It's high level , That is to say 1, Then corresponding changes should be made during initialization
If you use the XOR operator directly , Then it can be set to 0、1 Is the corresponding level signal .

Running results :
 Insert picture description here
At this point, the running results are 31 individual , It's because the loop is set 31 Time , from 22 Column starts to repeat ,m Sequences are pseudo-random codes , Pseudo random code is what I understand : Known sequences with certain periodicity , The specific sequence data is determined according to the connection and series of feedback . It has certain random characteristics , And it has a certain periodicity

m Autocorrelation and cross-correlation of sequences

Correlation is one of the most important properties of pseudo-random sequences
Autocorrelation coefficient reflects the correlation degree of a sequence at different times , According to the calculation formula of autocorrelation coefficient in random signal analysis, we can know , The calculation of correlation coefficient is a process similar to convolution , It's just that when calculating convolution, you need to flip the sequence and slide it to multiply it , But the correlation coefficient is a direct sliding multiplication ( The process of integration ), Since it's similar to convolution , Then we can use the frequency domain method to calculate

For example, there are two different sequences :c1 c2

The formula is :
Autocorrelation :c=ifft(fft(c1).*conj(fft(c1)))
Cross correlation :c=ifft(fft(c1).*conj(fft(c2)))

Use code to generate two different m Sequence , And calculate the correlation
Complete code :

r=5;
g=1*ones(1,r)
for k=1 :(2^r-1)
    out(k)=g(r);%%%out
    %tmp=g(r-1)*g(r);%%feedback
    tmp = xor(g(r-1),g(r));% XOR the last two digits 
    g(2:r)=g(1:r-1);
    g(1)=tmp;% Put the last bit of the register to the first bit , Make the next shift 
end

r1=5;
g1=1*ones(1,r1)
for k=1 :(2^r1-1)
    out1(k)=g1(r1);%%%out
    %tmp=g(r-1)*g(r);%%feedback
    tmp1 = xor(g1(r1-2),g1(r1));% XOR the last two digits 
    g1(2:r1)=g1(1:r1-1);
    g1(1)=tmp1;% Put the last bit of the register to the first bit , Make the next shift 
end

%c1 c2 There are two different sequences 
figure (1);
c1 = fft(out);
c2 = conj(c1);
c3 = ifft(c1.*c2);
plot(c3);
figure (2);
c4 = fft(out1);
c5 = ifft(c4.*c2);
plot(c5);

Running results :
Autocorrelation :
 Insert picture description here
Cross correlation :
 Insert picture description here

It can be seen that ,m Sequence or pseudo-random code sequence has high autocorrelation and low cross-correlation

Spread spectrum communication requires that spread spectrum sequence should have good random characteristics , and m The sequence is random , And it has a certain periodicity , So it is a pseudo-random sequence ,m The sequence should have the character of shift addition 、 Balance and run characteristics .
The above simulation results show that :m The autocorrelation coefficient of the sequence appears in t =0 There's a spike at , And Р For cycles to recur . The bottom width of the peak is 2T..T The smaller it is , The sharper the correlation peak is . cycle P The bigger it is ,1/P The smaller . under these circumstances ,m The better the autocorrelation of the sequence . Two periods of the same length , Generated by different feedback coefficients m Sequence , Compared with the autocorrelation, it has no sharp binary property , It's multivalued . As an address code , The smaller the cross-correlation function, the better , This makes it easy to distinguish between different users , Or say , Strong anti-interference ability .

原网站

版权声明
本文为[haoming Hu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202200528576545.html