?? main1.m
字號:
% ofdm adaptive predistorter.m
% Simulation program to realize adaptive predistortion in OFDM transmission system
%********************** preparation part ***************************
para=128; % Number of parallel channel to transmit (points)
fftlen=128; % FFT length
noc=128; % Number of carrier
nd=6; % Number of information OFDM symbol for one loop
ml=4; % Modulation level : 16QAM
sr=250000; % Symbol rate
br=sr.*ml; % Bit rate per carrier
gilen=32; % Length of guard interval (points)
ebn0=100; % Eb/N0
cap=512; % the capacity of lut
table_an=ones(1,cap); % the amplitude talbe
table_pn=zeros(1,cap);% the phase table
table_indicate=[1,zeros(1,cap-2),1];% the indicate table
%************************** main loop part **************************
nloop=100; % Number of simulation loops
noe = 0; % Number of error data
nod = 0; % Number of transmitted data
eop=0; % Number of error packet
nop=0; % Number of transmitted packet
for iii=1:nloop
%************************** transmitter *******************************
%************************** Data generation ***************************
seldata=rand(1,para*nd*ml)>0.5; % rand : built in function
%****************** Serial to parallel conversion *********************
paradata=reshape(seldata,para,nd*ml); % reshape : built in function
[ich,qch]=qammod(paradata,para,nd,ml);
%************************** QAM modulation ****************************
kmod=1/sqrt(2); % sqrt : built in function
ich1=ich.*kmod;
qch1=qch.*kmod;
%******************* IFFT *********************************************
x=ich1+qch1.*i;
y=ifft(x); % ifft : built in function
ich2=real(y); % real : built in function
qch2=imag(y); % imag : built in function
%************** Parallel to serial conversion ***********************
ich3=reshape(ich2,1,para*nd);
qch3=reshape(qch2,1,para*nd);
n=para*nd;
%************** R/P transformation*************************************
[in_an,in_pn]=RP(ich3,qch3);
%************** Predistorter*******************************************
[out2_an,out2_pn,table_an,table_pn,table_indicate]=predistorter(in_an,in_pn,table_an,table_pn,table_indicate);
%**************** P/R transformation***********************************
[ich4,qch4]=PR(out2_an,out2_pn);
%****************** Serial to parallel conversion *********************
ich5=reshape(ich4,para,nd);
qch5=reshape(qch4,para,nd);
%********* Gurad interval insertion ***********************************
[ich6,qch6]= giins(ich4,qch4,fftlen,gilen,nd);
fftlen2=fftlen+gilen;
%********* Attenuation Calculation ************************************
spow=sum(ich6.^2+qch6.^2)/nd./para; % sum : built in function
attn=0.5*spow*sr/br*10.^(-ebn0/10);
attn=sqrt(attn);
%*************************** Receiver ******************************
%***************** AWGN addition *************************************
[ich7,qch7]=comb(ich6,qch6,attn);
%****************** Guard interval removal ***************************
[ich8,qch8]= girem(ich7,qch7,fftlen2,gilen,nd);
%****************** FFT ********************************************
rx=ich8+qch8.*i;
ry=fft(rx); % fft : built in function
ich9=real(ry); % real : built in function
qch9=imag(ry); % imag : built in function
end
%**************** constellation figure********************************
figure(1)
plot(ich9,qch9,'*');
figure(2)
plot(ich2,qch2,'*');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -