⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpskdraw.m

📁 OFDM系统在QPSK与16QAM调制下
💻 M
字号:
%QPSK调制下OFDM系统的误码率
function [ber1] = qpskdraw;
para = 52;%并行信道数
fftlen = 64;%FFT长度
noc = 52;%载波数
nd = 6;%每个仿真循环的OFDM数
m1 = 2;%调制水平:QPSK
gilen = 16;%保护间隔长度

sr = 250000;%OFDM symbol rate (250k syombol/s)
br = sr.*m1;%bit rate per carrier
%**************************主循环部分*********************************
nloop = 200;%仿真的循环数
%noe1 = 0;%信道解码前错误数据数
%nod1 = 0;%信道解码前传输数据数
%*************************发射机**************************************
ebn0 = 0:15;%信噪比
for ii = 1:length(ebn0);
    noe1 = 0;%信道解码前错误数据数
    nod1 = 0;%信道解码前传输数据数
for iii = 1:nloop
    %****************************数据产生******************************
    xx = ones(1,para*nd*m1);
    %**************************串并转换*********************************
    paradata = reshape(xx,para,nd*m1);
    %************************QPSK调制**********************************
    [ich,qch] = qpskmod1(paradata,para,nd,m1);
    kmod = 1/sqrt(2);
    ich = ich.*kmod;
    qch = qch.*kmod;
    %数据映射
    [ich1,qch1] = cramapping(ich,qch,fftlen,nd);
    %*******************************IFFT********************************
    x = ich1 + qch1.*i;
    y = ifft(x);
    ich2 = real(y);
    qch2 = imag(y);
    %**************************插入保护间隔******************************
    [ich3,qch3] = giins1(ich2,qch2,fftlen,gilen,nd);
    fftlen2 = fftlen + gilen;
    %**************************attenuation calculation*********************
    spow = sum(ich3.^2+qch3.^2)/nd./para;
    attn = 0.5*spow*sr/br*10.^(-ebn0(ii)/10);
    attn = sqrt(attn);
    %**************************AWGN addition******************************
    [ich4,qch4] = comb(ich3,qch3,attn);
    %**********************去除保护间隔***********************************
    [ich5,qch5] = girem1(ich4,qch4,fftlen2,gilen,nd);
    %*************************FFT*****************************************
    rx = ich5 + qch5.*i;
    ry = fft(rx);
    ich6 = real(ry);
    qch6 = imag(ry);
    %载波逆映射
    [ich7,qch7] = crdemapping(ich6,qch6,fftlen,nd);
    %******************************解调**********************************
    ich7 = ich7./kmod;
    qch7 = qch7./kmod;
    [demodata] = qpskdemod1(ich7,qch7,para,nd,m1);
    %*****************************并串转换*******************************
    demodata1 = reshape(demodata,1,para*nd*m1);
    %****************************bit error rate(BER)*********************
    noe10 = sum(abs(demodata1 - xx));
    nod10 = length(xx);
    
    noe1 = noe10 + noe1;
    nod1 = nod10 + nod1;
    
   % fprintf('%d\t%e\t\n',iii,noe10/nod10);
end

ber1(ii) = noe1/nod1;
%********************************输出结果**********************************
%fprintf('%f\t%e\t%d\t\n',ebn0(ii),ber1(ii),nloop);
end
%********************************绘图**************************************
%semilogy(ebn0,ber1);
%grid on;
%*******************************end of file********************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -