thseq.m

来自「超宽带多用户系统仿真,误码率仿真,内容很好」· M 代码 · 共 31 行

M
31
字号

function THseq=THseq(bits,fc,Tc,Ts,THcode)
% --------------------------------------------------
% Step One - Implementation of the 2PPM-TH modulator
% --------------------------------------------------
%产生信号序列
fc=50e9;
bits=rand(1,20)>0.5;
Tc=1e-9;
Ts=5e-9;
THcode = floor(rand(1,3).*2);
dt = 1 ./ fc;                   % sampling period
framesamples = floor(Ts./dt);   % no. of samples between
chipsamples = floor (Tc./dt);   % no. of samples for t
THp = length(THcode);           % TH-code periodicity

totlength = framesamples*length(bits);
THseq=zeros(1,totlength);
% ------------------------------------------------

for k = 1 : length(bits)
    
    % uniform pulse position
    index = 1 + (k-1)*framesamples;
    
    % introduction of TH
    kTH = THcode(1+mod(k-1,THp));
    index = index + kTH*chipsamples;
    THseq(index) = 1;
end % for k = 1 : length(seq)

⌨️ 快捷键说明

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