victory.dj96
Newbie level 3
i am working on papr reduction in ofdm using slm and clippping method, please help me in understanding the matlab code for these techniques.
thanks!
thanks!
clc;
clear all;
close all;
L=input('Enter the L factor(1 to 1.5)= ');
N=input('Enter the number of transmitted symbols= ');
M=input('Enter the alphabet size= ');
k=[0:0.5:10];
k1=[1:N];
r=floor(M*rand(N,1));
modulated_data=qammod(r,M);
LN=floor(L*N);
parallel_data=modulated_data';
zero_padding=[parallel_data(1:N) zeros(1,LN-N)]';
ifft_data=ifft(zero_padding);
x_mag=abs(ifft_data);
papr=max(x_mag.^2)/mean(x_mag.^2);
figure(1)
plot(x_mag),title('Normal OFDM signal');
xlabel('time'),ylabel('amplitude')
y=abs(ifft_data).^2;
y1=sort(y,'descend');
y3=y1./mean(x_mag.^2);
y4=10*log10(y3)
[d,k] = hist(y4,k);
figure(2)
semilogy(k,1-cumsum(d)/max(cumsum(d)),'-r')
CR=5;
x_max=(10^(CR/20))*mean(x_mag);
for j=1:LN
if(x_mag(j,1)>x_max)
x_mag1(j,1)=x_max;
else
x_mag1(j,1)=x_mag(j,1);
end;
end;
figure(3)
plot(x_mag1),title('Clipped OFDM signal with CR=5 dB');
xlabel('time'),ylabel('amplitude')
papr1=max(x_mag1.^2)/mean(x_mag1.^2);
c=abs(x_mag1).^2;
c1=sort(c,'descend');
c2=c1./mean(x_mag1.^2);
c3=10*log10(c2)
[dc,k] = hist(c3,k);
CR1=1;
x_max1=(10^(CR1/20))*mean(x_mag);
for j=1:LN
if(x_mag(j,1)>x_max1)
x_mag2(j,1)=x_max1;
else
x_mag2(j,1)=x_mag(j,1);
end;
end;
c21=abs(x_mag2).^2;
c22=sort(c21,'descend');
c31=c22./mean(c21);
c34=10*log10(c31);
[c35,k]=hist(c34,k);
papr2=max(x_mag2.^2)/mean(x_mag2.^2);
figure(4)
plot(x_mag2),title('Clipped OFDM signal with CR=1 dB');
xlabel('time'),ylabel('amplitude')
figure(5)
semilogy(k,1-cumsum(dc)/max(cumsum(dc)),'-k')
figure(6)
semilogy(k,1-cumsum(c35)/max(cumsum(c35)),'-k')
figure(7)
semilogy(k,1-cumsum(d)/max(cumsum(d)),'-sr',k,1-cumsum(dc)/max(cumsum(dc)),'-+b',k,1-cumsum(c35)/max(cumsum(c35)),'-<g')
xlabel('PAPR (dB)');ylabel('CCDF');
title('CCDF VS PAPR');grid on;hold on;
hleg=legend('ORIGINAL','clipping with CR=5 dB','clipping with CR=1 dB');