# 基于Matlab实现OFDM系统高功率放大器效应

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

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

🍊个人信条：格物致知。

## ⛄ 完整代码

%==========================================================================

% The mfile investigates the effects of high power amplifier on the ofdam

% signals. The effects on spectrum ang Modulation Error Rate (MER) is of

% more concern.

%

% Written By     : Hamid Ramezani

% Date           : 17-Jun-2007

% Code version   : 1

% Matlab Version : 7.4.0.287 (R2007a)

%==========================================================================

% Initialization

clear all;

close all;

clc;

%==========================================================================

% Setting Parameters

%==========================================================================

% OFDM System Parameters

N           = 256;      % length of OFDM IFFT (16,32,64,...,2^n)

M           = 64;       % number of QAM constellation points (4,16,64,256)

numOfZeros  = N/4+1;    % numOfZeros must be an odd number and lower

% than N. The zero padding operation is

% necessarry in practical implementations.

GI          = 1/4;      % Guard Interval (1/4,1/8,1/16,...,4/N)

BW          = 20;       % OFDM signal Band width in MHz

numOfSym    = 100;      % number of OFDM Symbols

% Amplifire Parameters

satLevel = 5;   % in dB , higher than the tx out mean of voltage

%==========================================================================

%   Main Program

%==========================================================================

txData     = randint(N-numOfZeros,numOfSym,M);  % data generation

% QAM modulation

txDataMod  = qammod(txData,M);

zeros(numOfZeros,numOfSym);...

txDataMod(1:(N-numOfZeros+1)/2+1,:)];

% Note : in practice zero padding operation must be followed by

% a standard. Usually the last part of data frame shifts to the first

% part of zero padded frame.

% IFFT

% Guard Interval Insertion

% Amplifier Model

% tx data amplitude standard deviation and mean

% tx data phase in radian

% It is imagined that the amplifier has no effect on the phase of the

% signal. The solid state amplifier effects on signal phase is about 5

% degrees. The amplifier AM/AM response is followed by x/sqrt(1+(x/k)^2)

% no change in the phase

% mean of amplitude after amplification

% standard deviation after amplification

% polar to cartesian conversion

% Guard Interval removal

% FFT operation

% zero removal and rearrangement

% demodulation

rxDataHPA          = qamdemod(rxDataModHPA/mean(std(rxDataModHPA))*mean(std(txDataMod)),M);

%==========================================================================

%       statistical computation

%==========================================================================

% Mean Error Rate computation

MER       = 10*log10(mean(var(rxDataModHPA./mean(std(rxDataModHPA))...

- txDataMod./mean(std(txDataMod)))));

% Bit Error Rate computation

[num BER] = symerr(rxDataHPA,txData);

%==========================================================================

% graphical observation

%==========================================================================

f1 = figure(1);

set(f1,'color',[1 1 1]);

subplot(2,2,1);

spectrumFftSize = 2*N;

% spectrum of signal befor High Power Amplifier

% spectrum of signal after High Power Amplifier

% corresponding frequency

Freq    = linspace(-BW/2,BW/2,length(txSpec));

plot(Freq,[txSpec(length(txSpec)/2:length(txSpec));...

txSpec(1:(length(txSpec)/2-1))]);

hold on

grid on

plot(Freq,[HpaSpec(length(txSpec)/2:length(txSpec));...

HpaSpec(1:(length(txSpec)/2-1))],'r');

grid on;

xlabel('representing frequency');

ylabel('spectrum signals (first symbol)');

title('Spectrum Effects')

legend('Befor Amplifier','After Amplifier')

subplot(2,2,2);

plot(real(reshape(rxDataModHPA,1,numOfSym*(N-numOfZeros)))/mean(std(rxDataModHPA)),...

imag(reshape(rxDataModHPA,1,numOfSym*(N-numOfZeros)))/mean(std(rxDataModHPA)),'.r')

hold on

plot(real(reshape(txDataMod,1,numOfSym*(N-numOfZeros)))/mean(std(txDataMod)),...

imag(reshape(txDataMod,1,numOfSym*(N-numOfZeros)))/mean(std(txDataMod)),'.b')

xlabel('I channel');

ylabel('Q channel');

title('signal Constelleations');

legend('After Amplifier','Before Amplifier');

subplot(2,2,3)

% normalize amplitude

txAmp = linspace(0,5,100);

amAmp = txAmp./(1+(txAmp/satLevel).^2);

plot(txAmp,txAmp,'b');

hold on

plot(txAmp,amAmp,'r');

plot(1,1,'om');

xlabel('Input Amplitude');

ylabel('Output Amplitude');

title('AM/AM response of power amplifier');

legend('Linear Response','Amplifier Response','Mean of OFDM Amplitude');

subplotHandel = subplot(2,2,4);

text(0,1 ,['Mean Error Rate     : ',num2str(MER),' dB']);

text(0,.8,['Bit  Error Rate     : ',num2str(BER)]);

text(0,.6,['Modulation          : ',num2str(M),' QAM']);

text(0,.4,['IFFT Size           : ',num2str(N),' points']);

text(0,.2,['Guard Interval Size : ',num2str(N),' points']);

text(0,.0,['Saturation Level    : ',num2str(satLevel),' dB relative to AM Avg']);

% setting the axes invisibale

set(subplotHandel,'Xcolor',[1 1 1]);

set(subplotHandel,'Ycolor',[1 1 1]);

## ⛄ 参考文献

[1]孙志雄. 基于MATLAB的OFDM系统仿真分析[J]. 信息技术, 2007, 31(12):4.

##### ❤️ 关注我领取海量matlab电子书和数学建模资料

|
2月前
|

58 2
|
1月前
|
Windows

45 4
|
3天前
|

8 0
|
29天前
|

46 2
|
1月前
|

60 12
|
1月前
|

【matlab】matlab基于DTW和HMM方法数字语音识别系统（源码+音频文件+GUI界面）【独一无二】
【matlab】matlab基于DTW和HMM方法数字语音识别系统（源码+音频文件+GUI界面）【独一无二】
29 4
|
1月前
|

53 4
|
1月前
|

34 4
|
1月前
|

32 0
|
1月前
|

MATLAB - 系统辨识 - 在线估计 - Online Estimation
MATLAB - 系统辨识 - 在线估计 - Online Estimation
31 0