-
Notifications
You must be signed in to change notification settings - Fork 3
/
TxSimu.m
50 lines (43 loc) · 1.21 KB
/
TxSimu.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function [txWaveForm,txDmrs,txData]=TxSimu()
global puschDMRS;
sysCfg=sysCfgStr();
subcarriers=sysCfg.subcarriers;
ts=sysCfg.ts;
fd=0;
fftsize=sysCfg.fftsize;
maxPathNum=sysCfg.maxPathNum;
%% ready Tx data
txData=[];
txWaveForm=[];
for i=1:7
%% generate Tx modulate symbols
if(i==4)
%txDmrs=DMRS(1,:).';
txDmrs=puschDMRS(1:sysCfg.subcarriers);
txSymbols=txDmrs;
else
txSymbols=lteSymbolModulate(randi(2,1,sysCfg.modbits*subcarriers)-1, sysCfg.modm);
txData=[txData,txSymbols];
end
%% do DFT :sysCfg.subcarriers
%% close DFT
txPrecodingSym=txSymbols;%fft(txSymbols,sysCfg.subcarriers);
%if(i==4)
% txDmrsFd = txPrecodingSym;
%end
%% Data->SubCarrier Mapping[Shift]
fftInData=subMapFreq(txPrecodingSym,subcarriers,fftsize);
%% do IFFT :sysCfg.fftsize [shift processing!!!!]
a=ifft(fftInData,sysCfg.fftsize);
if(i==1)
WaveForm=[a(end-sysCfg.firstCp+1:end);a];% add CP
else
WaveForm=[a(end-sysCfg.normalCp+1:end);a];% add CP
end
txWaveForm=[txWaveForm;WaveForm];
end
%% wireless channel
%a=fft(txWaveForm); %F2T
%txWaveFormWithCh=awgn(a,SNR);
%txWaveFormWithCh=channelpath(txWaveForm,chan,SNR);
end