📄 get_ofdm_preamble.m
字号:
function preamble=get_ofdm_preamble(ofdm_sim);
%
%
%
if strcmp(lower(ofdm_sim.preamble_type), 'ieee802_11a'),
ShortTrainingSymbols= sqrt(13/6)*[0 0 1+j 0 0 0 -1-j 0 0 0 1+j 0 0 0 -1-j 0 0 0 -1-j 0 0 0 1+j 0 0 0 0 0 0 -1-j 0 0 0 -1-j 0 0 0 ...
1+j 0 0 0 1+j 0 0 0 1+j 0 0 0 1+j 0 0].';
LongTrainingSymbols=[1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 ...
1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1].';
%Generate first ten short training symbols
short_training_symbols = tx_freqd_to_timed(ShortTrainingSymbols, ofdm_sim.Nfft);
% Pick one short training symbol
Strs = short_training_symbols(1:16);
% extend to ten short training symbols
short_preamble=repmat(Strs, 10, 1);
% next generate the long training symbols
long_training_symbol = tx_freqd_to_timed(LongTrainingSymbols, ofdm_sim.Nfft);
%double size prefix and the long training symbols
index=ofdm_sim.Nfft-2*ofdm_sim.Ncp+1: ofdm_sim.Nfft;
long_preamble = [long_training_symbol(index); long_training_symbol; long_training_symbol];
preamble=[short_preamble; long_preamble];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
elseif ~isempty(findstr(lower(ofdm_sim.preamble_type), 'mseq')),
preamble_len=ofdm_sim.Nu;
freqd_symbols=get_preamble(ofdm_sim.preamble_type, preamble_len);
%note for MIMO, pilot info should be a matrix.
%a matrix to store OFDM symbols
OFDMsymbols=zeros(ofdm_sim.Nfft, ofdm_sim.tx_num);
for ic_tx=1: ofdm_sim.tx_num,
%merge the OFDM data and the pilot info
OFDMsymbols([ofdm_sim.UsedSubcIndex], ic_tx)=freqd_symbols;
end
timed_symbols=freqd_to_timed(OFDMsymbols, ofdm_sim.Nfft);
ofdm_preamble1=add_ofdm_prefix(timed_symbols, ofdm_sim.Nfft, ofdm_sim.Ncp);
preamble=[ofdm_preamble1; ofdm_preamble1; ofdm_preamble1];
else
disp('Other types of preambles not supported.');
return;
end
if ofdm_sim.tx_num>1,
disp('MIMO support is coming soon...');
return;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -