当前位置:网站首页>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 ,
Module two plus : Same as 0, Dissimilarity is 1, It's equivalent to doing XOR
m Sequence generation process

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 :
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 :
Cross correlation :
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 .
边栏推荐
- Spicy food advertising e-commerce system development function and spicy food advertising e-commerce app system development source code sharing
- The whole page turns gray
- Penetration tool environment - installing sqli labs in centos7 environment
- Dynamic proxy
- Zhangxiaobai's way of penetration (V) -- detailed explanation of upload vulnerability and parsing vulnerability
- 20. MVVM command binding of WPF
- ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
- Today, I will explain to you what is DFI and its development prospects
- Huikan source code -- Huikan app system secondary development source code sharing
- How to use ARIMA model for prediction?
猜你喜欢

Service charge and time setting code sharing involved in crmeb withdrawal process

An article clearly explains MySQL's clustering / Federation / coverage index, back to table, and index push down

揭秘GaussDB(for Redis):全面對比Codis

Navicat premium view password scheme

Rank sum ratio comprehensive evaluation method for common models in mathematical modeling

ECSHOP quickly purchases goods, simplifies the shopping process, and improves the user experience through one-step shopping

What is Flink? What can Flink do?

Uncover gaussdb (for redis): comprehensive comparison of CODIS

Swagger document generated by node project API in vscode

Upgrade opsenssh to 8.8p1
随机推荐
ECSHOP upload video_ ECSHOP video list, video classification, video related product guide
Zhangxiaobai's way of penetration (III) -- detailed explanation of SQL injection vulnerability principle (SQL Server)
Ten commandments of self-learning in machine learning
【数据中台】数据中台的OneID是个什么鬼,主数据它不香吗?
ARM 立即数
Mysql database logs binlog save aging (expire\u logs\u days)
What is the primordial universe
VIM common commands and shortcut keys
PHP multidimensional array sorting
Thinkphp3 count ` *'problem
Zhangxiaobai's road to penetration (7) -sql injection detailed operation steps -union joint query injection
[on]learning dynamic and hierarchical traffic spatiotemporal features with transformer
20. MVVM command binding of WPF
The first techo day Tencent technology open day in 2022 will be held online on June 28
ECSHOP video list_ ECSHOP uploading video, video classification, video list playing video function
Initialize the project using the express framework
ECSHOP whole site custom URL supports directory type
Spicy food advertising e-commerce system development function and spicy food advertising e-commerce app system development source code sharing
Jeecgboot startup popup configuration is still incorrect
Laravel multi project mutual access