资源简介
QAM16调制程序,MATLAB语言编写
代码片段和文件信息
% Program 3-21
% qam16
%
% Simulation program to realize 16QAM transmission system
%
% Programmed by H.Harada and R.Funada
%
%******************** preparation part *************************************
sr=256000.0; % Symbol rate
ml=4; % ml:Number of modulation levels (BPSK:ml=1 QPSK:ml=2 16QAM:ml=4)
br=sr .* ml; % Bit rate
nd = 1000; % Number of symbols that simulates in each loop
ebn0=6; % Eb/N0
IPOINT=8; % Number of oversamples
%********************** Filter initialization **************************
irfn=21; % Number of taps
alfs=0.5; % Rolloff factor
[xh] = hrollfcoef(irfnIPOINTsralfs1); %Transmitter filter coefficients
[xh2] = hrollfcoef(irfnIPOINTsralfs0); %Receiver filter coefficients
%************************** START CALCULATION *******************************
nloop=100; % Number of simulation loops
noe = 0; % Number of error data
nod = 0; % Number of transmitted data
for iii=1:nloop
%*************************** Data generation ********************************
data1=rand(1nd*ml)>0.5;
%*************************** 16QAM Modulation ********************************
[ichqch]=qammod(data11ndml);
[ich1qch1]= compoversamp(ichqchlength(ich)IPOINT);
[ich2qch2]= compconv(ich1qch1xh);
%**************************** Attenuation Calculation ***********************
spow=sum(ich2.*ich2+qch2.*qch2)/nd;
attn=0.5*spow*sr/br*10.^(-ebn0/10);
attn=sqrt(attn);
%********************** Fading channel **********************
% Generated data are fed into a fading simulator
% [ifadeqfade]=sefade(ich2qch2itaudlvlth1n0itnd1now1length(ich2)tstpfdflat);
% Updata fading counter
% itnd1 = itnd1+ itnd0;
%********************* Add White Gaussian Noise (AWGN) **********************
[ich3qch3]= comb(ich2qch2attn);% add white gaussian noise
[ich4qch4]= compconv(ich3qch3xh2);
sampl=irfn*IPOINT+1;
ich5 = ich4(sampl:IPOINT:length(ich4));
qch5 = qch4(sampl:IPOINT:length(ich4));
%**************************** 16QAM Demodulation *****************************
[demodata]=qamdemod(ich5qch51ndml);
%******************** Bit Error Rate (BER) ****************************
noe2=sum(abs(data1-demodata));
nod2=length(data1);
noe=noe+noe2;
nod=nod+nod2;
fprintf(‘%d\t%e\n‘iiinoe2/nod2);
end % for iii=1:nloop
%********************** Output result ***************************
ber = noe/nod;
fprintf(‘%d\t%d\t%d\t%e\n‘ebn0noenodnoe/nod);
fid = fopen(‘BERqam.dat‘‘a‘);
fprintf(fid‘%d\t%e\t%f\t%f\t\n‘ebn0noe/nodnoenod);
fclose(fid);
%******************** end of file ***************************
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2780 2005-01-08 15:59 qam16.m
----------- --------- ---------- ----- ----
2780 1
- 上一篇:银行系统数据库设计
- 下一篇:KSVDMatlab程序
评论
共有 条评论