psm_th.m
来自「在超宽带中实现直接序列脉冲形状调制」· M 代码 · 共 60 行
M
60 行
%
% FUNCTION 2.4 : "cp0201_2PPM_TH"
%
% Introduces the TH code given by 'THcode'
% and implements binary PPM modulation
% 'seq' is the input binary strem
% 'fc' is the sampling frequency for the generated signal
% 'Tc' is the chip time
% 'Ts' is the average pulse repetition time
% 'dPPM' is the PPM delta shift
% 'THcode' is the Time Hopping Code
%
% The function generates two output streams
% '2PPMTHseq' is the output with both TH and 2PPM
% 'THseq' is the output with the TH only
%
% Programmed by Guerino Giancola
%
function [PSMTHseq1,PSMTHseq2,THseq]= ...
PSM_TH(seq,fc,Tc,Ts,THcode)
% --------------------------------------------------
% Step One - Implementation of the 2PPM-TH modulator
% --------------------------------------------------
dt = 1 ./ fc; % sampling period
framesamples = floor(Ts./dt); % no. of samples between
% pulses
chipsamples = floor (Tc./dt); % no. of samples for the
% chip duration
THp = length(THcode); % TH-code periodicity
totlength = framesamples*length(seq);
PSMTHseq1=zeros(1,totlength);
PSMTHseq2=zeros(1,totlength);
THseq=zeros(1,totlength);
% ------------------------------------------------
% Step Two - main loop for introducing TH and 2PPM
% ------------------------------------------------
for k = 1 : length(seq)
% 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;
if seq(k)==0
PSMTHseq1(index)=1;
end
if seq(k)==1
PSMTHseq2(index)=1;
end
end % for k = 1 : length(seq)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?