: OFDM Simulator (outer function)
clear all;
A = [1 1/exp(1) 1/exp (2) ]; % power delay profile
N = 64; % number of symbols in a single OFDM symbol
GI = 16; % guard in terval
Mt = 1; % n umber of Tx antennas
Mr = 1; % n umber of Rx antennas
sig2 = 1e-3; % no ise varia nee
M = 8; % max eon stellati on bit n umber
Mgap = (1:():); % gap
Btot = 100*Mt; % total # bits per OFDM symbol
TransmitIter = 50; % # iterations of symbol transmissions for each channel instanee Channeliter = 100; % # iterations of independent identically distributed channel instances Gapiter = len gth(Mgap);
load
load
load
load
load
TotEbNo =[];
Errors =[];
EbNo =[];
for lGap = 1:Gaplter
lGap
gap = Mgap(lGap);
totalErrors = 0;
for lCha n = 1:Cha nn ellter
% create cha nnel
[H h_f]=create_cha nn el(Mt, Mr, A, N+GI);
% decompose each subcha nnel in the freque ncy doma in
[U S V] = svd_decompose_cha nn el(Mt, Mr, h_f, N);
% bitloadi ng
[bits_alloc,e nergy_alloc] = BitLoad(S,Btot,Mt*N,gap,sig2,M);
%en ergy_alloc=e nergy_alloc/(mea n(e nergy_alloc));
%e nergy_alloc=o nes(1,128);
for lTra ns = 1:Tra nsmitlter
% bits to tra nsmit
x = (ra ndn (1,Btot)>0);
% modulate
x_mod = modulate(x,bits_alloc,e nergy_alloc, s2,s4,s16,s64,s256);
% precode modulated sig nal x_pre = precode(Mt, x_mod, V, N);
% ifft, with cyclic p
OFDM-MATLAB仿真程序资料 来自淘豆网m.daumloan.com转载请标明出处.