前言
本文对减小 OFDM 峰值平均功率比(PAPR—Peak to Average Power Ratio)的内容以思维导图的形式呈现,有关仿真部分进行了讲解实现。
一、PAPR 减小
减小 OFDM 峰值平均功率比思维导图如下图所示,如有需求请到文章末尾端自取。
二、MATLAB 仿真
1、OFDM 信号的 CCDF
互补累积分布函数(CCDF,CF超过Z的概率
):
简化了的 累积分布函数(CDF,CF未超过Z的概率
):
①、MATLAB 源码
mapper.m
function [modulated_symbols,Mod] = mapper(b,N) % If N is given, it generates a block of N random 2^b-PSK/QAM modulated symbols. % Otherwise, it generates a block of 2^b-PSK/QAM modulated symbols for [0:2^b-1]. %MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang %2010 John Wiley & Sons (Asia) Pte Ltd M=2^b; % Modulation order or Alphabet (Symbol) size if b==1, Mod='BPSK'; A=1; mod_object=comm.PSKModulator('ModulationOrder', M); elseif b==2, Mod='QPSK'; A=1; mod_object = comm.PSKModulator('ModulationOrder', M, 'PhaseOffset', pi/4); else Mod=[num2str(2^b) 'QAM']; Es=1; A=sqrt(3/2/(M-1)*Es); mod_object = comm.RectangularQAMModulator('ModulationOrder', M, 'SymbolMapping', 'Gray'); end if nargin==2 % generates a block of N random 2^b-PSK/QAM modulated symbols modulated_symbols = A * mod_object(randi([0 M-1], N, 1)); else modulated_symbols = A * mod_object((0:M-1)'); end
PAPR.m
function [PAPR_dB, AvgP_dB, PeakP_dB] = PAPR(x) % PAPR_dB : PAPR[dB] % AvgP_dB : Average power[dB] % PeakP_dB : Maximum power[dB] %MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang %2010 John Wiley & Sons (Asia) Pte Ltd Nx=length(x); xI=real(x); xQ=imag(x); Power = xI.*xI + xQ.*xQ; PeakP = max(Power); PeakP_dB = 10*log10(PeakP); AvgP = sum(Power)/Nx; AvgP_dB = 10*log10(AvgP); PAPR_dB = 10*log10(PeakP/AvgP);
plot_CCDF.m
% plot_CCDF.m % Plot the CCDF curves of Fig. 7.3. clear all; clc; clf Ns = 2.^[6:10]; % OFDM系统中的子载波数量 b=2; % 指定每个符号的比特数 M=2^b; % 根据 b 计算调制阶数 Nblk = 1e3; % 设置仿真的块数 %mod_object = modem.qammod('M',M, 'SymbolOrder','gray'); %Es=1; A=sqrt(3/2/(M-1)*Es); zdBs = [4:0.1:10]; N_zdBs = length(zdBs); %Ray_fnc = inline('z/s2*exp(-z^2/(2*s2))','s2','z'); CCDF_formula=inline('1-((1-exp(-z.^2/(2*s2))).^N)','N','s2','z'); % Eq.(7.9) % 代码使用内联函数 inline 定义了函数 CCDF_formula for n = 1:length(Ns) % 循环遍历 Ns 中的值 N=Ns(n); % 设置当前的子载波数量 x = zeros(Nblk,N); % 初始化一个数组 x,用于存储OFDM时域信号 sqN=sqrt(N); % 计算 N 的平方根 for k = 1:Nblk % 进行 OFDM 块的仿真 %msgint=randint(1,N,M); X=A*modulate(mod_object,msgint); X = mapper(b,N); % 使用 QPSK 调制方案生成 N 个调制符号 x(k,:) = ifft(X,N)*sqN; % 对 X 执行逆快速傅里叶变换(IFFT),并乘以 sqN 进行能量归一化 CFx(k) = PAPR(x(k,:)); % 计算时域信号 x 的峰均比(PAPR) end s2 = mean(mean(abs(x)))^2/(pi/2); % 计算时域信号 x 的平均功率以估计方差 s2。 % 使用 CCDF_formula 函数和 PAPR 值计算理论和仿真的 CCDF 值 CCDF_theoretical=CCDF_formula(N,s2,10.^(zdBs/20)); % 使用公式 Eq.(7.9) 中指定的参数 N、s2 和 zdBs 计算理论 CCDF for i = 1:N_zdBs %zdB=zdBs(i); %z=10^(zdB/20); %CCDF_theoretical(i)=CCDF_formula(N,s2,z); CCDF_simulated(i) = sum(CFx>zdBs(i))/Nblk; % 通过计数大于阈值 zdBs(i) 的 PAPR 值的数量并将其除以总块数 Nblk,估计仿真的 CCDF end semilogy(zdBs,CCDF_theoretical,'k-'); hold on; grid on; % 使用对数坐标绘制理论 CCDF 曲线 semilogy(zdBs(1:3:end),CCDF_simulated(1:3:end),'k:*'); % 使用对数坐标绘制仿真 CCDF 曲线 end axis([zdBs([1 end]) 1e-2 1]); title('OFDM system with N-point FFT'); xlabel('PAPR0[dB]'); ylabel('CCDF=Probability(PAPR>PAPR0)'); legend('Theoretical','Simulated');
②、仿真结果
上图显示了当 N = 64,128,256,512,1024 时,OFDM 信号的理论 CCDF 和仿真 CCDF,当 N 变小时,仿真结果偏离理论值,这说明只有 N 足够大时,式(7.11)才是精确的。
2、单载波基带/通频带信号的 PAPR
①、MATLAB 源码
mapper.m
function [modulated_symbols,Mod] = mapper(b,N) % If N is given, it generates a block of N random 2^b-PSK/QAM modulated symbols. % Otherwise, it generates a block of 2^b-PSK/QAM modulated symbols for [0:2^b-1]. %MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang %2010 John Wiley & Sons (Asia) Pte Ltd M=2^b; % Modulation order or Alphabet (Symbol) size if b==1, Mod='BPSK'; A=1; mod_object=comm.PSKModulator('ModulationOrder', M); elseif b==2, Mod='QPSK'; A=1; mod_object = comm.PSKModulator('ModulationOrder', M, 'PhaseOffset', pi/4); else Mod=[num2str(2^b) 'QAM']; Es=1; A=sqrt(3/2/(M-1)*Es); mod_object = comm.RectangularQAMModulator('ModulationOrder', M, 'SymbolMapping', 'Gray'); end if nargin==2 % generates a block of N random 2^b-PSK/QAM modulated symbols modulated_symbols = A * mod_object(randi([0 M-1], N, 1)); else modulated_symbols = A * mod_object((0:M-1)'); end
modulation.m
function [s,time] = modulation(x,Ts,Nos,Fc) % Ts : Sampling period % Nos: Oversampling factor % Fc : Carrier frequency Nx=length(x); offset = 0; if nargin<5 scale = 1; T=Ts/Nos; % Scale and Oversampling period for Baseband else scale = sqrt(2); T=1/Fc/2/Nos; % Scale and Oversampling period for Passband end t_Ts = [0:T:Ts-T]; time = [0:T:Nx*Ts-T]; % One sampling interval and whole interval tmp = 2*pi*Fc*t_Ts+offset; len_Ts=length(t_Ts); cos_wct = cos(tmp)*scale; sin_wct = sin(tmp)*scale; %s = zeros(N*len_Ts,1); for n = 1:Nx s((n-1)*len_Ts+1:n*len_Ts) = real(x(n))*cos_wct-imag(x(n))*sin_wct; end
PAPR.m
function [PAPR_dB, AvgP_dB, PeakP_dB] = PAPR(x) % PAPR_dB : PAPR[dB] % AvgP_dB : Average power[dB] % PeakP_dB : Maximum power[dB] %MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang %2010 John Wiley & Sons (Asia) Pte Ltd Nx=length(x); xI=real(x); xQ=imag(x); Power = xI.*xI + xQ.*xQ; PeakP = max(Power); PeakP_dB = 10*log10(PeakP); AvgP = sum(Power)/Nx; AvgP_dB = 10*log10(AvgP); PAPR_dB = 10*log10(PeakP/AvgP);
single_carrier_PAPR.m
%%%%%%%%%%%%%%%%%%%%% 计算单载波基带/通频带信号的PAPR %%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%% single_carrier_PAPR.m %%%%%%%%%%%%% %%%%%%%%%%%%%%%%%程序说明 %%%%分析单载波下的PAPR,可画出图 %%%%%% 仿真环境 %软件版本:MATLAB R2019a clear Ts = 1; % 采样时间间隔 L = 8; % 每个符号的采样点数 Nos = 8; % 过采样因子 Fc = 1; % 载波频率 b = 2; % 比特数 M = 2^b; % 调制方案中的符号数 [X,Mod] = mapper(b); % 返回一个长度为 M 的复数向量 X,表示调制方案的符号集合;Mod 表示调制方案的名称 L_ = L*4; i_b = 1; [xt_pass_,time_] = modulation(X,Ts,L_,Fc); % 执行连续时间调制 [xt_pass,time] = modulation(X,Ts,L,Fc); % 执行过采样调制: for i_s = 1:M xt_base(L*(i_s-1)+1 : L*i_s) = X(i_s)*ones(1,L); % 生成基带信号 end PAPR_dB_base = PAPR(xt_base); % 计算基带信号的 PAPR figure(1); % clf; subplot(311); stem(time,real(xt_base),'k.'); % 绘制离散时间信号的实部 hold on; ylabel('S_{I}(n)'); %title([Mod ', ' num2str(M) ' symbols, Ts=' num2str(Ts) 's, Fs=' num2str(1/Ts*2*Nos) 'Hz, Nos=' num2str(Nos) ', baseband, g(n)=u(n)-u(n-Ts)']); subplot(312); stem(time,imag(xt_base),'k.'); % 绘制离散时间信号的虚部 hold on; ylabel('S_{Q}(n)'); subplot(313); stem(time,abs(xt_base).^2,'k.'); % 绘制离散时间信号的幅度平方 hold on; title(['PAPR = ' num2str(round(PAPR_dB_base(i_b)*100)/100) 'dB']); xlabel ('samples'); ylabel('|S_{I}(n)|^{2}+|S_{Q}(n)|^{2}'); figure(2); clf; PAPR_dB_pass(i_b) = PAPR(xt_pass); subplot(211); stem(time,xt_pass,'k.'); hold on; plot(time_,xt_pass_,'k:'); title([Mod ', ' num2str(M) ' symbols, Ts=' num2str(Ts) 's, Fs=' num2str(1/Ts*2*Nos) 'Hz, Nos=' num2str(Nos) ', Fc=' num2str(Fc) 'Hz, g(n)=u(n)-u(n-Ts)']); ylabel('S(n)'); subplot(212) stem(time,xt_pass.*xt_pass,'r.'); hold on; plot(time_,xt_pass_.*xt_pass_,'k:'); title(['PAPR = ' num2str(round(PAPR_dB_pass(i_b)*100)/100) 'dB']); xlabel('samples'); ylabel('|S(n)|^{2}'); %bb_I = zeros(1,M*Nos*2); bb_Q = zeros(1,M*Nos*2); disp('PAPRs of baseband/passband signals'); PAPRs_of_baseband_passband_signals=[PAPR_dB_base; PAPR_dB_pass]
②、仿真结果
基带信号的平均功率和峰值功率相同,因此它的 PAPR 是 0dB
通频带信号的 PAPR 是 3.01dB
注意:单载波信号的 PAPR 随载波频率 f c f_cfc 的变化而变化,因此,为了准确测量单载波系统的 PAPR,必须考虑通频带信号的载波频率。总之,单载波系统的 PAPR 可以由调制方案直接预测,而且不会很大,这与 OFDM 系统不同。
3、时域 OFDM 信号和幅度分布
①、MATLAB 源码
% OFDM_signal.m %MIMO-OFDM Wireless Communications with MATLAB㈢ Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung G. Kang %2010 John Wiley & Sons (Asia) Pte Ltd clear all; clc; clf; N=8; % 子载波数量 b=2; % 每个子载波的比特数 M=2^b; % 每个子载波的调制阶数 Nos=16; % 每个OFDM符号中的子载波数量 NNos=N*Nos; % 总的子载波数量 T=1/NNos; % 每个OFDM符号的持续时间 time = [0:T:1-T]; % 时间序列,从0到1,步长为T [X,Mod] = mapper(b,N); % 返回已调制符号X和调制方式Mod X(1)=0+1i*0; % A block of 16 QPSK symbols with no DC-subcarrier % 使用ifft函数生成OFDM符号x。根据子载波的索引i,分为两个分支,分别对应于前N/2个子载波和后N/2个子载波。根据索引i和NNos的值,使用ifft函数生成不同的输入序列x。 for i = 1:N if i<=N/2, x = ifft([zeros(1,i-1) X(i) zeros(1,NNos-i+1)],NNos); else x = ifft([zeros(1,NNos-N+i-1) X(i) zeros(1,N-i)],NNos); end xI(i,:) = real(x); xQ(i,:) = imag(x); end sum_xI = sum(xI); sum_xQ = sum(xQ); figure(1), clf, subplot(311) plot(time,xI,'k:','linewidth',1),hold on, plot(time,sum_xI,'b','linewidth',2) title([Mod ', N=' num2str(N)]); ylabel('x_{I}(t)'); axis([0 1 min(sum_xI) max(sum_xI)]); subplot(312) plot(time,xQ,'k:','linewidth',1); hold on, plot(time,sum_xQ,'b','linewidth',2) ylabel('x_{Q}(t)'); axis([0 1 min(sum_xQ) max(sum_xQ)]); subplot(313), plot(time,abs(sum_xI+j*sum_xQ),'b','linewidth',2); hold on; ylabel('|x(t)|'); xlabel('t'); clear('xI'), clear('xQ') N=2^4; NNos=N*Nos; T=1/NNos; time=[0:T:1-T]; Nhist=1e3; % 历史记录数 for k = 1:Nhist [X,Mod] = mapper(b,N); X(1)=0+j*0; % A block of 16 QPSK symbols with no DC-subcarrier for i = 1:N if (i<= N/2) x = ifft([zeros(1,i-1) X(i) zeros(1,NNos-i+1)],NNos); else x = ifft([zeros(1,NNos-N/2+i-N/2-1) X(i) zeros(1,N-i)],NNos); end xI(i,:) = real(x); xQ(i,:) = imag(x); end HistI(NNos*(k-1)+1:NNos*k) = sum(xI); HistQ(NNos*(k-1)+1:NNos*k) = sum(xQ); % 将xI和xQ的总和保存在矩阵HistI和HistQ中 end N_bin = 30; figure(2), clf, subplot(311) [xI_dist,bins] = hist(HistI,N_bin); bar(bins,xI_dist/sum(xI_dist),'k'); %#ok<HIST> title([Mod ', N=' num2str(N)]); ylabel('pdf of x_{I}(t)'); subplot(312) [xQ_dist,bins] = hist(HistQ,N_bin); bar(bins,xQ_dist/sum(xQ_dist),'k'); ylabel('pdf of x_{Q}(t)'); subplot(313) [xabs_dist,bins] = hist(abs(HistI+j*HistI),N_bin); bar(bins,xabs_dist/sum(xabs_dist),'k'); ylabel('pdf of |x(t)|'); xlabel('x_{0}');
OFDM——PAPR减小(二)https://developer.aliyun.com/article/1473989