OFDM通信基于matlab深度学习OFDM系统信号检测含Matlab源码 2023期

Posted 海神之光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OFDM通信基于matlab深度学习OFDM系统信号检测含Matlab源码 2023期相关的知识,希望对你有一定的参考价值。

一、深度学习OFDM系统信号检测简介

1 OFDM系统模型
OFDM系统是一种常用的多载波调制方式, 因为其具有能够在带宽较窄的情况下传输大量数据、能够对抗频率选择性衰落、传输速率高、实现简单、信道利用率高、抗窄带干扰能力强等优点而受到广泛使用。本节主要介绍了OFDM系统实现的基本原理以及系统模型。

1.1OFDM系统基本原理
因为频谱资源十分珍贵,如果一个信道仅仅只传输一路信号,那无疑是对频谱资源的浪费, 为了能够充分利用信道带宽, 频分复用是一种很好的方法。OFDM技术是频分复用方法的一种,其基本原理如下:将串行的高速数据流转换为低速的并行数据流,然后将数据调制到相互正交的子载波上4Q。OFDM系统可以通过DFT和ID FT的方法产生相互正交的子载波,然后利用子载波之间的正交性,将原始信号从子载波中分离开来,通过这种方法可以实现OFDM无线通信系统中信号的发送与接收。

1.2OFDM系统模型
OFDM符号是由若干个子载波组成, 且每个子载波都要受到相移键控I+!!(phase-shift keying, PSK) 或者正交幅度调制+2(Quadrature Amplitude Modulation, QAM) 的调制。在发送端, 设N为子载波的数量, T为OFDM符号的宽度, d(i=0, 1…N-1)为分配给每个子载波的数据符号, f:为第0个子载波的载波频率, rect() =1, |sT/2,则从t=1, 开始的OFDM符号表达式为:


但是使用离散傅里叶变换也有其缺点, 因为随着OFDM无线通信系统的子载波数目的增多,离散傅里叶变换的运算复杂度也会呈指数倍增长,因此在实际工程中常常使用FFT/IF FT代替离散傅里叶变换, 这样可以很大程度上减少运算的时间和占用的硬件资源,同时也可以降低数据传输时延。

由图2.2所示, 信源发出比特流信号, 比特流信号需要经过PSK或者QAM调制,然后经过串并转换的同时加入导频信号后被分成M路数据,M路数据经过快速傅里叶逆变换后转换为N个时域离散信号, 插入循环前缀(Cyclic Prefix, CP) 是为了避免ICI对整个系统的影响,其具体过程是取N个时域信号的后L,位数据放在该符号的前面形成循环结构, 这样就能保证即使是有时延的OFDM符号在经过FFT后依然是整数倍周期。最后将插入CP之后的OFDM符号经过并串转换之后就可以通过发射机发送出去。接收机接收到信号之后先把数据进行串并转换,然后按照按照插入CP的方式移除CP,CP的长度应该大于信道的时延, 只有这样才能消除符号间干扰, 然后对信号进行FFT变换,将信号从时域转换到频域,接收信号可以表示为
Y=XH+Z(2-8)
式中:Y为接收信号的频域形式,x为发送信号的频域形式,H为信道冲激响应,z为噪声。

二、部分源代码

%% Clear workspace

clear variables;
close all;

%% Load common parameters and the trained NN

load(‘SimParametersPilot64.mat’);
load(‘TrainedNetPilot64.mat’);

%% Other simulation parameters

NumPilot = length(FixedPilot);
PilotSpacing = NumSC/NumPilot;
NumOFDMsym = NumPilotSym+NumDataSym;
NumClass = length(Label);
NumPath = length(h);

% Load pre-calculated channel autocorrelation matrix for MMSE estimation
% This autocorrelation matrix is calculated in advance using the 3GPP
% channel model, which can be replaced accordingly.
load(‘RHH.mat’);

%% SNR range

Es_N0_dB = 0:2:20; % Es/N0 in dB
Es_N0 = 10.^(Es_N0_dB./10); % linear Es/N0
N0 = 1./Es_N0;
NoiseVar = N0./2;

%% Testing data size

NumPacket = 10000; % Number of packets simulated per iteration

%% Simulation

% Same pilot sequences used in training and testing stages
FixedPilotAll = repmat(FixedPilot,1,1,NumPacket);

% Number of Monte-Carlo iterations
NumIter = 1;

% Initialize error rate vectors
SER_DL = zeros(length(NoiseVar),NumIter);
SER_LS = zeros(length(NoiseVar),NumIter);
SER_MMSE = zeros(length(NoiseVar),NumIter);

for i = 1:NumIter

for snr = 1:length(NoiseVar)
    
    %% 1. Testing data generation
    
    noiseVar = NoiseVar(snr);
            
    % OFDM pilot symbol (can be interleaved with random data symbols)
    PilotSym = 1/sqrt(2)*complex(sign(rand(NumPilotSym,NumSC,NumPacket)-0.5),sign(rand(NumPilotSym,NumSC,NumPacket)-0.5)); 
    PilotSym(1:PilotSpacing:end) = FixedPilotAll;

    % OFDM data symbol
    DataSym = 1/sqrt(2)*complex(sign(rand(NumDataSym,NumSC,NumPacket)-0.5),sign(rand(NumDataSym,NumSC,NumPacket)-0.5)); 

    % Transmitted OFDM frame
    TransmittedPacket = [PilotSym;DataSym];
    
    % Received OFDM frame
    ReceivedPacket = genTransmissionReceptionOFDM(TransmittedPacket,LengthCP,h,noiseVar);
    
    % Collect the data labels for the selected subcarrier
    DataLabel = zeros(size(DataSym(:,idxSC,:)));
    for c = 1:NumClass
        DataLabel(logical(DataSym(:,idxSC,:) == 1/sqrt(2)*Mod_Constellation(c))) = Label(c);
    end
    DataLabel = squeeze(DataLabel); 

    % Testing data collection
    XTest = cell(NumPacket,1);
    YTest = zeros(NumPacket,1);       
    for c = 1:NumClass
        [feature,label,idx] = getFeatureAndLabel(real(ReceivedPacket),imag(ReceivedPacket),DataLabel,Label(c));
        featureVec = mat2cell(feature,size(feature,1),ones(1,size(feature,2))); 
        XTest(idx) = featureVec;
        YTest(idx) = label;
    end
    YTest = categorical(YTest);
    
    %% 2. DL detection
    
    YPred = classify(Net,XTest,'MiniBatchSize',MiniBatchSize);
    SER_DL(snr,i) = 1-sum(YPred == YTest)/NumPacket;
    
    %% 3. LS & MMSE detection
    
    % Channel estimation
    wrapper = @(x,y) performChanEstimation(x,y,RHH,noiseVar,NumPilot,NumSC,NumPath,idxSC);
    ReceivedPilot = mat2cell(ReceivedPacket(1,:,:),1,NumSC,ones(1,NumPacket));
    PilotSeq = mat2cell(FixedPilotAll,1,NumPilot,ones(1,NumPacket));
    [EstChanLS,EstChanMMSE] = cellfun(wrapper,ReceivedPilot,PilotSeq,'UniformOutput',false);
    EstChanLS = cell2mat(squeeze(EstChanLS));
    EstChanMMSE = cell2mat(squeeze(EstChanMMSE));
    
    % Symbol detection
    SER_LS(snr,i) = getSymbolDetection(ReceivedPacket(2,idxSC,:),EstChanLS,Mod_Constellation,Label,DataLabel);
    SER_MMSE(snr,i) = getSymbolDetection(ReceivedPacket(2,idxSC,:),EstChanMMSE,Mod_Constellation,Label,DataLabel);
    
end

end
function ReceivedPacket = genTransmissionReceptionOFDM(TransmittedFrame,LengthCP,h,NoiseVar)
% This function is to model the transmission and reception process in OFDM systems.

% Extract parameters
[NumSym,NumSC,NumPacket] = size(TransmittedFrame);

%% Transmitter

PhaseShift = exp(-1j*rand(1,NumPacket)2pi);

for p = 1:NumPacket

% 1. IFFT
x1 = ifft(TransmittedFrame(:,:,p),NumSC,2); 

% 2. Inserting CP
x1_CP = [x1(:,NumSC-LengthCP+1:end) x1]; 
    
% 3. Parallel to serial transformation
x2 = x1_CP.';
x = x2(:);

% 4. Channel filtering
y_conv = conv(h*PhaseShift(p),x);
y(:,p) = y_conv(1:length(x)); 

end

%% Adding noise

SeqLength = size(y,1);

% Calculate random noise in time domain
NoiseF = sqrt(NoiseVar)/sqrt(2).(randn(NumPacket,NumSC)+1jrandn(NumPacket,NumSC)); % Frequency-domain noise
NoiseT = sqrt(SeqLength)*sqrt(SeqLength/NumSC)*ifft(NoiseF,SeqLength,2); % Time-domain noise

% Adding noise
y = y+NoiseT.';

%% Receiver

ReceivedPacket = zeros(NumPacket,NumSym,NumSC);

for p = 1:NumPacket

% 1. Serial to parallem transformation
y1 = reshape(y(:,p),NumSC+LengthCP,NumSym).'; 

% 2. Removing CP
y2 = y1(:,LengthCP+1:LengthCP+NumSC);

% 3. FFT, # x NymSym x 64
ReceivedPacket(p,:,:) = fft(y2,NumSC,2); % NumSym x 64

end

ReceivedPacket = permute(ReceivedPacket,[2,3,1]);

三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 高俊伟.基于深度学习的OFDM信号检测算法研究[D].哈尔滨工程大学

3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除

以上是关于OFDM通信基于matlab深度学习OFDM系统信号检测含Matlab源码 2023期的主要内容,如果未能解决你的问题,请参考以下文章

误码率仿真基于matlab多径信道下OFDM通信系统误码率仿真含Matlab源码 2078期

基于matlab的索引OFDM系统误码率仿真

现代通信基于matlab OFDM通信系统仿真含Matlab源码 1005期

现代通信基于OFDM通信系统仿真matlab源码

OFDM通信基于matlab OFDM多用户资源分配仿真含Matlab源码 1902期

基于STBC空时分组码的OFDM通信系统误码率matlab仿真