cp0402_2PAM_TH.m
资源名称:CP0402.zip [点击查看]
上传用户:yuandalvye
上传日期:2013-07-19
资源大小:3k
文件大小:2k
源码类别:
屏幕保护
开发平台:
Matlab
- %
- % 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)