dsss_transmitter
CROSS-REFERENCE INFORMATION
- generatePRBS Generate PRBS sequence - choose from either msequence or gold code
- repeatSequence Repeat a given sequence x of arbitrary length to match the given
- dsss_transmitter_plot
- dsss_tx_rx_chain ----PRBS definition----
SOURCE CODE
0001 function [s_t,carrier_ref,prbs_ref]=dsss_transmitter(d,prbsType,G1,G2,X1,X2,Rb,Rc,L) 0002 %Direct Sequence Spread Spectrum (DSSS) transmitter - returns the 0003 %DSSS waveform (s), reference carrier, the prbs reference waveform 0004 %for use in synchronization in the receiver 0005 %d - input binary data stream 0006 %prbsType - type of PRBS generator - 'MSEQUENCE' or 'GOLD' 0007 % If prbsType == 'MSEQUENCE' G1 is the generator poly for LFSR 0008 % and X1 its seed. G2 and X2 are not used 0009 % If prbsType == 'GOLD' G1,G2 are the generator polynomials 0010 % for LFSR1/LFSR2 and X1,X2 are their initial seeds. 0011 %G1,G2 - Generator polynomials for PRBS generation 0012 %X1,X2 - Initial states of LFSRs 0013 %Rb - data rate (bps) for the data d 0014 %Rc - chip-rate (Rc >> Rb AND Rc is integral multiple of Rb) 0015 %L - oversampling factor for waveform generation 0016 0017 prbs = generatePRBS(prbsType,G1,G2,X1,X2); 0018 prbs=prbs(:); d=d(:); %serialize 0019 dataLen= length(d)*(Rc/Rb);%required PRBS length to cover the data 0020 prbs_ref= repeatSequence(prbs,dataLen);%repeat PRBS to match data 0021 0022 d_t = kron(d,ones(L*Rc/Rb,1)); %data waveform 0023 prbs_t = kron(prbs_ref,ones(L,1)); %spreading sequence waveform 0024 sbb_t = 2*xor(d_t,prbs_t)-1; %XOR data and PRBS, convert to bipolar 0025 n=(0:1:length(sbb_t)-1).'; carrier_ref=cos(2*pi*2*n/L); 0026 s_t = sbb_t.*carrier_ref; %modulation,2 cycles per chip 0027 0028 figure(1); %Plot waveforms 0029 subplot(3,1,1); plot(d_t); title('data sequence'); hold on; 0030 subplot(3,1,2); plot(prbs_t); title('PRBS sequence'); 0031 subplot(3,1,3); plot(s_t); title('DS-SS signal (baseband)'); end