⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pngen.m

📁 These files in Matlab implement a conventional DS -CDMA detector using QPSK modulation and matched f
💻 M
字号:
%% Generation of PN sequence with a given length N , given input state
%% and a generator polynomial 

%  Note : Length of the generator polynomial is equal to N and is in the
%  following form :- s
%  Positions    15  14  13  12  11  10  9  8  7  6  5  4  3  2  1  
%  Gen_Poly= [  1   0   1   0   0   0   1  1  1  0  1  0  0  0  1]


function [y]=PNgen(N,gen_poly);

intial_state = [zeros(length(gen_poly)-1, 1); 1];

final_state=zeros(1,N);
pn_seq=[];

for i=1:N
    final_state(2:end)=intial_state(1:end-1);
    final_state(1)=mod(sum(intial_state(find(gen_poly(2:end)))),2);
    pn_seq(i)=final_state(N);
    intial_state=final_state;    
end
y=pn_seq;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -