将下面的代码中的QPSK调制改为16QAM调制 : function PAPR_QPSK_Clipping Num_Loop=30000; Num_Subcarrier=64; Mapper=[ 1+1i -1+1i 1-1i -1-1i]/sqrt(2);%QPSK %Mapper=[-3+3j,-1+3j,1+3j,3+3j,... % -3+1j,-1+1j,1+1j,3+1j,... % -3-1j,-1-1j,1-1j,3-1j,... % -3-3j,-1-3j,1-3j,3-3j];%16QAM % J=5;%Oversampling factor CR=4;%Clipping Ratio PAPR_Original=zeros(1,Num_Loop); PAPR_Clipping=zeros(1,Num_Loop); for n=1:Num_Loop InputSymbolIndex=randi([1 4],1,Num_Subcarrier); OFDM_Freq=Mapper(InputSymbolIndex); OFDM_Time=sqrt(J*Num_Subcarrier)*ifft([OFDM_Freq(1:Num_Subcarrier/2) zeros(1,(J-1)*Num_Subcarrier) OFDM_Freq(Num_Subcarrier/2+1:Num_Subcarrier)]); PAPR_Original(n)=10*log10(max(abs(OFDM_Time)).^2./mean(abs(OFDM_Time).*2)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Clipping Method for p=1:J*Num_Subcarrier if abs(OFDM_Time(p))>CR OFDM_Time(p)= CR*cos(angle(OFDM_Time(p)))+1i*CR*sin(angle(OFDM_Time(p))); end end PAPR_Clipping(n)=10*log10(max(abs(OFDM_Time)).^2./mean(abs(OFDM_Time).^2)); end Pr_Ori=[]; Pr_Clip=[]; PAPRO_Start=2; PAPRO_End=12; step=0.2; count=1; for m=PAPRO_Start:step:PAPRO_End temp_Ori=sum(PAPR_Original(:)>m)/Num_Loop; temp_Clip=sum(PAPR_Clipping(:)>m)/Num_Loop; Pr_Ori(count)=temp_Ori; Pr_Clip(count)=temp_Clip; count=count+1; end semilogy(PAPRO_Start:step:PAPRO_End,Pr_Ori,' -b*',PAPRO_Start:step:PAPRO_End,Pr_Clip,'-r*'); axis([PAPRO_Start PAPRO_End 10^-4 1]); grid on; hold on;
时间: 2024-01-24 10:20:36 浏览: 70
function PAPR_16QAM_Clipping
Num_Loop=30000;
Num_Subcarrier=64;
Mapper=[-3+3j,-1+3j,1+3j,3+3j,...
-3+1j,-1+1j,1+1j,3+1j,...
-3-1j,-1-1j,1-1j,3-1j,...
-3-3j,-1-3j,1-3j,3-3j];%16QAM
J=5;%Oversampling factor
CR=4;%Clipping Ratio
PAPR_Original=zeros(1,Num_Loop);
PAPR_Clipping=zeros(1,Num_Loop);
for n=1:Num_Loop
InputSymbolIndex=randi([1 16],1,Num_Subcarrier);
OFDM_Freq=Mapper(InputSymbolIndex);
OFDM_Time=sqrt(J*Num_Subcarrier)*ifft([OFDM_Freq(1:Num_Subcarrier/2) zeros(1,(J-1)*Num_Subcarrier) OFDM_Freq(Num_Subcarrier/2+1:Num_Subcarrier)]);
PAPR_Original(n)=10*log10(max(abs(OFDM_Time)).^2./mean(abs(OFDM_Time).*2));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Clipping Method
for p=1:J*Num_Subcarrier
if abs(OFDM_Time(p))>CR
OFDM_Time(p)= CR*cos(angle(OFDM_Time(p)))+1i*CR*sin(angle(OFDM_Time(p)));
end
end
PAPR_Clipping(n)=10*log10(max(abs(OFDM_Time)).^2./mean(abs(OFDM_Time).^2));
end
Pr_Ori=[];
Pr_Clip=[];
PAPRO_Start=2;
PAPRO_End=12;
step=0.2;
count=1;
for m=PAPRO_Start:step:PAPRO_End
temp_Ori=sum(PAPR_Original(:)>m)/Num_Loop;
temp_Clip=sum(PAPR_Clipping(:)>m)/Num_Loop;
Pr_Ori(count)=temp_Ori;
Pr_Clip(count)=temp_Clip;
count=count+1;
end
semilogy(PAPRO_Start:step:PAPRO_End,Pr_Ori,' -b*',PAPRO_Start:step:PAPRO_End,Pr_Clip,'-r*');
axis([PAPRO_Start PAPRO_End 10^-4 1]);
grid on;
hold on;
end
阅读全文