基于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电子书和数学建模资料


相关文章
|
21天前
|
数据安全/隐私保护
地震波功率谱密度函数、功率谱密度曲线,反应谱转功率谱,matlab代码
地震波格式转换、时程转换、峰值调整、规范反应谱、计算反应谱、计算持时、生成人工波、时频域转换、数据滤波、基线校正、Arias截波、傅里叶变换、耐震时程曲线、脉冲波合成与提取、三联反应谱、地震动参数、延性反应谱、地震波缩尺、功率谱密度
|
21天前
|
数据安全/隐私保护
耐震时程曲线,matlab代码,自定义反应谱与地震波,优化源代码,地震波耐震时程曲线
地震波格式转换、时程转换、峰值调整、规范反应谱、计算反应谱、计算持时、生成人工波、时频域转换、数据滤波、基线校正、Arias截波、傅里叶变换、耐震时程曲线、脉冲波合成与提取、三联反应谱、地震动参数、延性反应谱、地震波缩尺、功率谱密度
基于混合整数规划的微网储能电池容量规划(matlab代码)
基于混合整数规划的微网储能电池容量规划(matlab代码)
|
21天前
|
算法 调度
面向配电网韧性提升的移动储能预布局与动态调度策略(matlab代码)
面向配电网韧性提升的移动储能预布局与动态调度策略(matlab代码)
|
21天前
|
算法 调度
含多微网租赁共享储能的配电网博弈优化调度(含matlab代码)
含多微网租赁共享储能的配电网博弈优化调度(含matlab代码)
|
21天前
|
运维 算法
基于改进遗传算法的配电网故障定位(matlab代码)
基于改进遗传算法的配电网故障定位(matlab代码)
|
21天前
|
Serverless
基于Logistic函数的负荷需求响应(matlab代码)
基于Logistic函数的负荷需求响应(matlab代码)
|
21天前
|
供应链 算法
基于分布式优化的多产消者非合作博弈能量共享(Matlab代码)
基于分布式优化的多产消者非合作博弈能量共享(Matlab代码)
|
21天前
|
算法 调度
基于多目标粒子群算法冷热电联供综合能源系统运行优化(matlab代码)
基于多目标粒子群算法冷热电联供综合能源系统运行优化(matlab代码)
|
21天前
|
算法 调度 SoC
电动汽车充放电V2G模型(Matlab代码)
电动汽车充放电V2G模型(Matlab代码)

热门文章

最新文章