A.1.1.1
Symbol Mapping
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %
%% Name: cod.m %
%% %
%% Description: The function used in ofdm_tx for symbol mapping to %
%% required constellation. %
%% %
%% %
%% Parameters: %
%% Y = output QAM symbols. Bits = input PRBS bits %
%% m = constellation size. %
%% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function
Y=cod(Bits,m)
Ns=length(Bits)/m;
%Number of symbols
QAM=zeros(1,Ns);
%Variable initiation
Q=zeros(1,length(Bits)/2);
I=zeros(1,length(Bits)/2);
for
k=1:(length(Bits)/2)
I(1,k)=Bits(1,2*k-1);
%I bitsream. def used by QAM coder of TM in VPI
Q(1,k)=Bits(1,2*k);
%Q bitstram
end
for
k=1:Ns
x=0;
y=0;
for
l=1:m/2
x=x+2^(m/2-l)*(2*I(1,(k-1)*m/2+l)-1);
y=y+2^(m/2-l)*(2*Q(1,(k-1)*m/2+l)-1);
170
end
QAM(1,k) = x + i*y;
end
Y=QAM/(2^(m/2)-1);
A.2
WiMAX OFDM Receiver
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %
%% Name: OFDM_Rx.m %
%% %
%% Description: This function performs OFDM reception and channel %
%% equalisation. It also introduces ISI. %
%% %
%% %
%% Parameters: %
%% TimeWindow, BitRate, NFFT, BitPerSymbol, CyclicPrefix, BitStream= %
%% are passed from the VPI
%
%%
IQ=output recovered symbols channel=radio ch coef. %
%% SUI=type of radio ch
channel_reverse=equalisation %
%% SymbolTx=ISI distorted Tx symbol
%
%%
%
%% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function
IQ = OFDM_Rx(TimeWindow,BitRate,I,Q,Nfft,BitPerSymbol,CyclicPrefix)
InputSignal=[I+j*Q];
SUI=4;
%type of SUI channel (out of 6)
BW=14;
%bandwidth in MHz
channel=channelSUI(SUI, CyclicPrefix, BW);
%Channel coefficient creation
FrameLength=floor(Nfft*(1+CyclicPrefix));
NFrames=floor(TimeWindow*BitRate/BitPerSymbol/FrameLength);
for
i=1:NFrames
Frame=InputSignal((i-1)*FrameLength+1:i*FrameLength);
%Channel effect
NextSymbol = 8 .* sqrt(Nfft) .* ifft(randint(1,Nfft));
SymbolTx = [NextSymbol NextSymbol Frame];
symbol_channel = filter(channel,1,SymbolTx);
%applied channel
symbol_channel = symbol_channel(end-(256*(1+CyclicPrefix))+1:end);
S_symbolsRx(i,:)=receiver(symbol_channel,CyclicPrefix, Nfft);
channel_reverse(i,:) = channelestimate(S_symbolsRx(i,:),channel);
end
ReceivedSignal=zeros(1,TimeWindow*BitRate/BitPerSymbol);
for
u=1:NFrames
ReceivedSignal(1,(u-1)*Nfft+1:u*Nfft)= channel_reverse(u,:);
171
end
IQ=ReceivedSignal;
Do'stlaringiz bilan baham: |