📄 cp0402_2pam_th.m
字号:
%
% FUNCTION 4.1 : "cp0402_2PAM_TH"
%
% Introduces the DS code given by 'DScode'
% and implements binary PAM modulation
% 'seq' is the input binary stream
% 'fc' is the sampling frequency for the generated signal
% 'Ts' is the average pulse repetition period
% 'DScode' is the DS code
%
% The function generates two output streams:
% 'PAMTHseq' is the output with both TH and PAM
% 'THseq' is the output with TH only
%
% Programmed by Guerino Giancola
%
function [PAMTHseq,THseq] = ...
cp0402_2PAM_TH(seq,fc,Tc,Ts,THcode)
% --------------------------------------------------
% Step One - Implementation of the PAM+TH modulator
% --------------------------------------------------
dt = 1 ./ fc; % sampling period
framesamples=floor(Ts./dt);% number of samples between
% pulses
chipsamples = floor (Tc ./ dt); % number of samples for
% the chip duration
THp = length(THcode); % TH-code length
totlength = framesamples*length(seq);
PAMTHseq=zeros(1,totlength);
THseq=zeros(1,totlength);
% ---------------------------------------
% Step Two - Main loop for introducing TH
% ---------------------------------------
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;
PAMTHseq(index)=((seq(k)*2)-1);
end % for k = 1 : length(seq)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -