基于Matlab模拟AWGN 信道上 OFDM附完整代码

简介: 基于Matlab模拟AWGN 信道上 OFDM附完整代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测雷达通信 无线传感器

信号处理图像处理路径规划元胞自动机无人机 电力系统

⛄ 内容介绍

交频分复用 (Orthogonal Frequency Division Multiplexing OFDM) 是第四代 (the4th Generation,4G) 移动通信的核心技术,它的最大优点是对抗频率选择性衰落,同时又提高了频谱利用率。它不仅仅可以增加系统容量,更重要的是它能更好地满足多媒体通信要求,将包括语音、数据、影像等大量信息的多媒体业务通过宽频信道高品质地传送出去。 但是OFDM技术对频率偏移和相位噪声很敏感,所以同步是OFDM系统中的关键问题。缺乏必要的同步机制,各子频道的正交性就会受到破坏,从而引入子载波间干扰ICI(Intemal Channel Interference)。

⛄ 完整代码

%---------------------------------------------------------------------------------------------------

% In this example we show how OFDM system perform over AWGN channel. The

% simulation results will be checked with ones we obtain through

% theoritical analysis.

%


%---------------------------------------------------------------------------------------------------

% Initiliazation

clear         % clear all workspace variables

clc           % clear command window

close all     % close all open figures

mFileName     = mfilename;                              % Get mfile name

mFileNameFull = mfilename('fullpath');                  % Get mfile full name

mFileDirMain  = mFileNameFull(1:end-length(mFileName)); % Extract the dir of the mfile directory

if ~isempty(mFileDirMain)

   cd(mFileDirMain)    % change matlab current folder to mfile directory

end

clear mFileName mFileNameFull mFileDirMain              % clear variables

rng(0)                                                  % set the random seed to 0

if exist('OFDM_Class','class') == 8                     % Check if OFDM_Class exits

   OFDM_Class.checkForUpdatedVersion();                % Check if the class is updated

else

   fprintf('The OFDM_Class does not exist or its path is not added. You can download the class from this %s \n',...

       '<a href = "http://www.mathworks.com/matlabcentral/fileexchange/54070">Link</a>')

   return

end

%---------------------------------------------------------------------------------------------------

%                                            Main Part

%---------------------------------------------------------------------------------------------------

% Parameters

% First curve

Para1.NB                  = 5000;    % Number of ofdm symbols per run

Para1.I                   = 1;       % Number of iterations in each loop

Para1.M                   = 4;       % Modulation order (4 QPSK) it can be changed by user

Para1.N                   = 64;      % Number of sybcarriers

Para1.NFFT                = 64;      % Upsampling rate is 1, and FFT based interpolation is used

Para1.ifDoRaylieghChannel = 0;       % No Rayliegh channel

Para1.ifDoAWGNChannel     = 1;       % Only AWGN Channel

% Second curve

Para2 = Para1;                       % all parameters are the same as what defined in Para1 except the modulation order

Para2.M                   = 16;      % Modulation order (16 QAM) it can be changed by user

% Building class

Obj1 = OFDM_Class(Para1);

Obj2 = OFDM_Class(Para2);


% Loop Parameters

Loop.EbN0dB    = 0:10;


Loop.SNRdBVec1 = 10*log10(log2(Obj1.M))+Loop.EbN0dB;

Loop.SNRdBVec2 = 10*log10(log2(Obj2.M))+Loop.EbN0dB;


Loop.EbN0dBL = length(Loop.EbN0dB);

Loop.Results   = zeros(Loop.EbN0dBL,Obj1.I,8);

Loop.Cnt       = 0;


% Main Loop

fprintf('-------------------------------------\n')

for LoopCnt1 = 1 :  Loop.EbN0dBL

   % Update parameters

   Obj1.channSNRdB = Loop.SNRdBVec1(LoopCnt1);

   Obj2.channSNRdB = Loop.SNRdBVec2(LoopCnt1);

   for LoopCnt2 = 1 : Obj1.I

       % Transmitter

       Obj1.ofdmTransmitter();

       Obj2.ofdmTransmitter();

       % Channel

       Obj1.ofdmChannel();

       Obj2.ofdmChannel();

       % Receiver

       Obj1.ofdmReceiver();

       Obj2.ofdmReceiver();

       % BER calculation

       Obj1.ofdmBER();

       Obj2.ofdmBER();

       

       % Store the results for the first curve

       Loop.Results(LoopCnt1,LoopCnt2,1) = Obj1.BER;

       Loop.Results(LoopCnt1,LoopCnt2,2) = Obj1.DER;

       Loop.Results(LoopCnt1,LoopCnt2,3) = Obj1.BERTheoryAWGN;

       Loop.Results(LoopCnt1,LoopCnt2,4) = Obj1.EbN0dB;

       

       % Store the results for the second curve

       Loop.Results(LoopCnt1,LoopCnt2,5) = Obj2.BER;

       Loop.Results(LoopCnt1,LoopCnt2,6) = Obj2.DER;

       Loop.Results(LoopCnt1,LoopCnt2,7) = Obj2.BERTheoryAWGN;

       Loop.Results(LoopCnt1,LoopCnt2,8) = Obj2.EbN0dB;

       

       % Display

       Loop.Cnt = Loop.Cnt + 1;

       fprintf('%10.1f percent of the simulation is done.\n',Loop.Cnt*100/(Loop.EbN0dBL  * Obj1.I))

   end

end

fprintf('-------------------------------------\n')

% Plots

figure(1)

clf

semilogy(mean(Loop.Results(:,:,4),2), mean(Loop.Results(:,:,1),2),'bo:') % Simulation BER (first curve)

hold on

semilogy(mean(Loop.Results(:,:,4),2), mean(Loop.Results(:,:,3),2),'b-')  % Theory BER (first curve)

semilogy(mean(Loop.Results(:,:,8),2), mean(Loop.Results(:,:,5),2),'rs:') % Simulation BER (second curve)

semilogy(mean(Loop.Results(:,:,8),2), mean(Loop.Results(:,:,7),2),'r-')  % Theory BER (second curve)

grid on

xlabel('EbN0 [dB]')

ylabel('BER')

legend([Obj1.ModulationStr,'-Simulation'],[Obj1.ModulationStr,'-Theory'],...

   [Obj2.ModulationStr,'-Simulation'],[Obj2.ModulationStr,'-Theory'])

title('OFDM system performance over AWGN channel')

⛄ 运行结果

⛄ 参考文献

[1]任文超, 姜军. AWGN信道中一种改进OFDM系统信道估计算法[J].  2013.

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
4月前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
295 0
|
4月前
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
166 0
|
4月前
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
236 8
|
4月前
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
253 8
|
4月前
|
机器学习/深度学习 数据采集 测试技术
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
基于CEEMDAN-VMD-BiLSTM的多变量输入单步时序预测研究(Matlab代码实现)
172 8
|
4月前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
461 0
|
4月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
167 0
|
4月前
|
机器学习/深度学习 算法 自动驾驶
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
基于导向滤波的暗通道去雾算法在灰度与彩色图像可见度复原中的研究(Matlab代码实现)
270 8
|
4月前
|
编解码 运维 算法
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
【分布式能源选址与定容】光伏、储能双层优化配置接入配电网研究(Matlab代码实现)
278 12
|
4月前
|
人工智能 数据可视化 网络性能优化
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
【顶级SCI复现】虚拟电厂的多时间尺度调度:在考虑储能系统容量衰减的同时,整合发电与多用户负荷的灵活性研究(Matlab代码实现)
181 9

热门文章

最新文章