can anyone provide me the code for Partial Transmit Sequence without side information for PAPR reduction technique in OFDM ?
3 views (last 30 days)
Show older comments
This is my code, I am able to reduce PAPR and got the deired graphs but not able to detect side information. Please help me with this code.
clc
clear all;
close all;
N =64;
cc = N/8;
bps = 16;
spc = 1000;
SNR = 30;
bol = cc * spc * bps;
carriers = (1:cc) + (floor(N/4) - floor(cc/2));
conj_car = N - carriers + 2;
display(carriers);
display(conj_car);
baseband_out = round(rand(1,bol));
convert_matrix = reshape(baseband_out, bps, length(baseband_out)/bps);
for k = 1:(length(baseband_out)/bps)
modulo_baseband(k) = 0;
for i = 1:bps
modulo_baseband(k) = modulo_baseband(k) + convert_matrix(i,k)*2^(bps-i);
end
end
matrix = reshape(modulo_baseband, cc, spc)';
matrix = [zeros(1,cc);matrix];
for i = 2:(spc + 1)
matrix(i,:) = rem(matrix(i,:)+matrix(i-1,:),2^bps);
end
matrix = matrix * ((2*pi)/(2^bps));
[X,Y] = pol2cart(matrix, ones(size(matrix,1),size(matrix,2)));
complex_matrix = complex(X,Y);
IFFT_modulation = zeros(spc + 1, N);
IFFT_modulation(:,carriers) = complex_matrix;
IFFT_modulation(:,conj_car) = conj(complex_matrix);
ofdm_symbol=IFFT_modulation;
p0=2.*randint(8,1)-1;
p1=2.*randint(8,1)-1;
p2=2.*randint(8,1)-1;
p3=2.*randint(8,1)-1;
p4=2.*randint(8,1)-1;
p5=2.*randint(8,1)-1;
p6=2.*randint(8,1)-1;
p7=2.*randint(8,1)-1;
B=[p0,p1,p2,p3,p4,p5,p6,p7];
c=2;
for m=1:8
for n = 1:m
if (m==n)
B(m,n)=B(m,n).*c;
end
end
end
X = B;
size(X);
ds = mat2dataset(X,'VarNames',{'B0',...
'B1','B2','B3','B4','B5','B6','B7'});
size(ds);
NN=spc;
L=4;
ds(1:8,:)
c1 = B(:, 1);
c2 = B(:, 2);
c3 = B(:, 3);
c4 = B(:, 4);
c5 = B(:, 5);
c6 = B(:, 6);
c7 = B(:, 7);
c8 = B(:, 8);
for i=1:NN
time_domain_signal=abs(ifft([ofdm_symbol(i,1:32) zeros(1,(L-1)*N) ofdm_symbol(i,33:64)]));
meano=mean(abs(time_domain_signal).^2);
peako=max(abs(time_domain_signal).^2);
papro(i)=10*log10(peako/meano);
P1=[ofdm_symbol(i,1:8) zeros(1,56)];
P2=[zeros(1,8) ofdm_symbol(i,9:16) zeros(1,48)];
P3=[zeros(1,16) ofdm_symbol(i,17:24) zeros(1,40)];
P4=[zeros(1,24) ofdm_symbol(i,25:32) zeros(1,32)];
P5=[zeros(1,32) ofdm_symbol(i,33:40) zeros(1,24)];
P6=[zeros(1,40) ofdm_symbol(i,41:48) zeros(1,16)];
P7=[zeros(1,48) ofdm_symbol(i,49:56) zeros(1,8)];
P8=[zeros(1,56) ofdm_symbol(i,57:64)];
Pt1=abs(ifft([P1(1:32) zeros(1,(L-1)*N) P1(33:64)]));
Pt2=abs(ifft([P2(1:32) zeros(1,(L-1)*N) P2(33:64)]));
Pt3=abs(ifft([P3(1:32) zeros(1,(L-1)*N) P3(33:64)]));
Pt4=abs(ifft([P4(1:32) zeros(1,(L-1)*N) P4(33:64)]));
Pt5=abs(ifft([P5(1:32) zeros(1,(L-1)*N) P5(33:64)]));
Pt6=abs(ifft([P6(1:32) zeros(1,(L-1)*N) P6(33:64)]));
Pt7=abs(ifft([P7(1:32) zeros(1,(L-1)*N) P7(33:64)]));
Pt8=abs(ifft([P8(1:32) zeros(1,(L-1)*N) P8(33:64)]));
papr2(i)=papro(i);
for k=1:64
final_signal=p0*Pt1+p1*Pt2+p2*Pt3+p3*Pt4+p4*Pt5+p5*Pt6+p6*Pt7+p7*Pt8;
meank=mean(abs(final_signal).^2);
peak=max(abs(final_signal).^2);
papr=10*log10(peak/meank);
if papr < papr2(i)
papr2(i)=papr;
sig=final_signal;
end
end
papr3(i)=papro(i);
for k=1:64
final_signal1=c1*Pt1+c2*Pt2+c3*Pt3+c4*Pt4+c5*Pt5+c6*Pt6+c7*Pt7+c8*Pt8;
meank1=mean(abs(final_signal1).^2);
peak1=max(abs(final_signal1).^2);
papr1=10*log10(peak1/meank);
if papr1 < papr3(i)
papr3(i)=papr1;
sig1=final_signal1;
end
end
end
figure(1);
[N1,X1] = hist(papro,100);
semilogy(X1,1-cumsum(N1)/max(cumsum(N1)),'red');
xlabel('PAPR 0 dB')
ylabel('Probability(PAPR>0dB)')
title('Original vs reduced papr')
hold on
[N2,X2] = hist(papr2,100);
semilogy(X2,1-cumsum(N2)/max(cumsum(N2)),'blue');
hold on
[N3,X3] = hist(papr3,100);
semilogy(X3,1-cumsum(N3)/max(cumsum(N3)),'black');
h2=legend('orignal','Normal-PTS','I-PTS');
%xlabel('PAPR 0 dB')
%ylabel('Probability(PAPR>0dB)')
%title('papr of PTS OFDM')
%hold all
hold off
grid on
2 Comments
SHao Yu Hsieh
on 17 Nov 2019
Hello
Can you explain this code to me , please?
I am really desired to implment a whole OFDM system but I don't know how to write the code, especially how to decide those parameters
Please help me !
Answers (0)
See Also
Categories
Find more on OFDM in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!