29 lines
780 B
Mathematica
29 lines
780 B
Mathematica
![]() |
function tx_STF = STS_modulation(Numerology)
|
||
|
% total 9bits 5 for Numerology 4 for crc
|
||
|
% input is the No. of Numerology 0~26
|
||
|
|
||
|
preamblebit = de2bi(Numerology-1,5);
|
||
|
|
||
|
% CRC
|
||
|
poly = 'z4+z3+z2+z+1';
|
||
|
crcgenerator = comm.CRCGenerator(poly);
|
||
|
codeword = crcgenerator(preamblebit.');
|
||
|
crccode = codeword(6:end).';
|
||
|
% preamble mod
|
||
|
M=32;Q=16;
|
||
|
theta0 = [0 0 0 pi 0 pi pi 0 pi pi pi];
|
||
|
phi_mod = [0:1/M*2*pi:2*pi-1/M*2*pi];
|
||
|
v_mod = [0:1/Q*2*pi:2*pi-1/Q*2*pi];
|
||
|
|
||
|
load STS_M32Q16.mat STS_mod
|
||
|
|
||
|
phi_data = pskmod(bi2de(preamblebit),M,0,'gray');% for M
|
||
|
v_data = pskmod(bi2de(crccode),Q,0,'gray');% for Q
|
||
|
|
||
|
[~,phi_no] = min(abs(phi_mod-mod(angle(phi_data),2*pi)));
|
||
|
[~,v_no] = min(abs(v_mod-mod(angle(v_data),2*pi)));
|
||
|
STF = STS_mod(:,v_no,phi_no);
|
||
|
tx_STF = repmat(STF,10,1);
|
||
|
|
||
|
end
|