LAMPIRAN A Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM) dengan teknik Konstelasi Hadamard Modulasi QPSK
LAMPIRAN A
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
dengan teknik Konstelasi Hadamard Modulasi QPSK
clc clear all close all
%% Parameters OFDM % QPSK Modulation = 4QAM constellation
Bit = input( 'Bit = ' ); %Data Masukan Line=8; Fc = 4e9; % Frekuensi Carrier(Hz) c = 3e8; % m/s fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
S2P = reshape(gen_data,Line,[]); [a b] = size(S2P);
% Modulasi QPSK
N = Bit/Line; hModulator = comm.QPSKModulator( 'BitInput' , true); hModulator.PhaseOffset = pi/4;
for x = 1:N;
mod(:,x) = step(hModulator,S2P(:,x)); %QPSK Modulation
end % IFFT
ifft_func = abs(ifft(mod));
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% Parallel to Serial Converter
P2S=reshape(add_CP,1,[]); [rows_P2S cols_P2S]=size(P2S); len_ofdm_data = rows_P2S*cols_P2S;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(1) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j]; % QPSK randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data1=s(randsrc(1,48,2:4)); ofdm_symbol1(i,:)=[data1(1:10) pilot(1) data1(11:20) pilot(2) data1(21:30) pilot(3) data1(31:40) pilot(4) data1(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
time_domain_signal1=abs(ifft([ofdm_symbol1(i,1:32) zeros(1,(L- 1)*N) ofdm_symbol1(i,33:64)])); mean1=mean(abs(time_domain_signal1).^2); peak1=max(abs(time_domain_signal1).^2); papr1(i)=10*log10(peak1/mean1);
end
figure(2) [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy) grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' )
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
S2P = reshape(gen_data,Line,[]); [a b] = size(S2P);
% Modulasi QPSK
N = Bit/Line; hModulator = comm.QPSKModulator( 'BitInput' , true); hModulator.PhaseOffset = pi/4;
for x = 1:N;
mod(:,x) = step(hModulator,S2P(:,x)); %QPSK Modulation
end % Konstelasi Hadamard
lenght=64;
P(N)=60; row_index=P(N); modH=row_index*mod*lenght;
% IFFT
ifft_func = abs(ifft(modH));
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% Parallel To Serial Converter
P2S=reshape(add_CP,1,[]); [rows_P2S cols_P2S]=size(P2S); len_ofdm_data = rows_P2S*cols_P2S;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(3) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j]; % QPSK randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data=s(randsrc(1,48,1:4)); ofdm_symbol(i,:)=[data(1:10) pilot(1) data(11:20) pilot(2) data(21:30) pilot(3) data(31:40) pilot(4) data(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
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);
end
figure(12) [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ) grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Hadamard' )
% Buat Grafik CCDF
figure(13) [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy) hold on [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ) grid on title( 'QPSK Modulation' ); xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' , 'Hadamard' )
LAMPIRAN B
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
dengan teknik Konstelasi Hadamard Modulasi 16QAM
clc clear all close all
%% Parameters OFDM % QPSK Modulation = 4QAM constellation
Bit = input( 'Bit = ' ); %Data Masukan Line=8; Fc = 4e9; % Frekuensi Carrier(Hz) c = 3e8; % m/s fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
N = Bit/Line; S2P = reshape(gen_data,Line/2,[]); [a b] = size(S2P);
% Modulasi 16-QAM
dec = bi2de(S2P', 'left-msb' ); M = 16; hMod = modem.qammod(M); mod = modulate(hMod,dec); mod = reshape(mod,Line,[]);
% IFFT
ifft_func = abs(ifft(mod));
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% Parallel To Serial Converter
P2S=reshape(add_CP,1,[]); [rows_P2S cols_P2S]=size(P2S); len_ofdm_data = rows_P2S*cols_P2S;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(3) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j ,-1-3j -1+3j 1-3j 1+3j,-3-j -3+j 3-j 3+j,-3-3j -3+3j 3-3j 3+3j]; % 16QAM randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data1=s(randsrc(1,48,2:4)); ofdm_symbol1(i,:)=[data1(1:10) pilot(1) data1(11:20) pilot(2) data1(21:30) pilot(3) data1(31:40) pilot(4) data1(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
time_domain_signal1=abs(ifft([ofdm_symbol1(i,1:32) zeros(1,(L- 1)*N) ofdm_symbol1(i,33:64)])); mean1=mean(abs(time_domain_signal1).^2); peak1=max(abs(time_domain_signal1).^2); papr1(i)=10*log10(peak1/mean1);
end
figure(6) [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy) grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' )
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Modulasi 16QAM % Serial To Parallel Converter
N = Bit/Line; S2P = reshape(gen_data,Line/2,[]); [a b] = size(S2P);
% Modulasi 16-QAM
dec = bi2de(S2P', 'left-msb' ); M = 16; hMod = modem.qammod(M); mod = modulate(hMod,dec); mod = reshape(mod,Line,[]);
% Konstelasi Hadamard lenght=64; P(N)=60; row_index=P(N); modH=row_index*mod*lenght;
% IFFT
ifft_func = abs(ifft(modH));
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% Parallel To Serial Converter
P2S=reshape(add_CP,1,[]); [rows_P2S cols_P2S]=size(P2S); len_ofdm_data = rows_P2S*cols_P2S;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(3) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j ,-1-3j -1+3j 1-3j 1+3j,-3-j -3+j 3-j 3+j,-3-3j -3+3j 3-3j 3+3j]; % 16QAM randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data=s(randsrc(1,48,1:4)); ofdm_symbol(i,:)=[data(1:10) pilot(1) data(11:20) pilot(2) data(21:30) pilot(3) data(31:40) pilot(4) data(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
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);
end
figure(12) [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ) grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Hadamard' )
% Buat Grafik CCDF
figure(13) [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy) hold on [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ) grid on title( '16-QAM Modulation' ); xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' , 'Hadamard' )
LAMPIRAN G
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
clc clear all close all
%% Initializing Parameters % QPSK Modulation = 4QAM constellation % 16QAM Modulation = 16QAM constellation
Bit = input( 'bit = ' ); %Data Masukan mod_type = input( 'Enter the modulation type[1 for QPSK,2 for 16QAM]:
' );
Line = 8; %Jumlah Baris Fc = 4e9; % Frekuensi Carrier (Hz) c = 3e8; % m/s fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit); figure(1), stairs(gen_data); title( 'Membangkitkan Data Bit Secara Acak' ); axis([-0.5 Bit -0.5 1.5]); xlabel( 'Data Bit' ); ylabel( 'Amplitude' );
% Modulasi QPSK & 16QAM
nc = [4;16]; % 4=(4QAM = QPSK) ; 16=16QAM mode = nc(mod_type);
switch mode case
4
% Serial To Parallel Converter
S2P = reshape(gen_data,Line,[]); [a b]= size(S2P); figure(2); subplot(411);stairs(S2P(1,:)); axis([-0.5 b -0.5
1.5]);title( 'Serial to Parallel Converter' );xlabel( 'Data
Bit' );ylabel( 'Amplitude' );
subplot(412);stairs(S2P(2,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' ); subplot(413);stairs(S2P(3,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' ); subplot(414);stairs(S2P(4,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' );
% Modulasi QPSK
N = Bit/Line; hModulator = comm.QPSKModulator( 'BitInput' ,true); hModulator.PhaseOffset = pi/4; for x = 1:N;
mod(:,x)=step(hModulator,S2P(:,x)); %QPSK Modulation
end
figure(3), plot(mod, 'bo' ); title( 'Constellation Modulation QPSK' ); grid off ; axis([-2 2 -2 2]); xlabel( 'In-Phase' ); ylabel( 'Quadrature' );
case
16
% Serial To Parallel Converter
S2P = reshape(gen_data,Line/2,[]); [a b]= size(S2P); figure(2); subplot(411);stairs(S2P(1,:)); axis([-0.5 b -0.5
1.5]);title( 'Serial to Parallel Converter' );xlabel( 'Data
Bit' );ylabel( 'Amplitude' );
subplot(412);stairs(S2P(2,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' ); subplot(413);stairs(S2P(3,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' ); subplot(414);stairs(S2P(4,:)); axis([-0.5 b -0.5 1.5]);xlabel( 'Data Bit' );ylabel( 'Amplitude' );
% Modulasi 16-QAM
dec = bi2de(S2P', 'left-msb' ); M = 16; hMod = modem.qammod(M); mod = modulate(hMod,dec); figure(3), plot(mod, 'bo' ); title( 'Constellation Modulation 16-QAM' ); grid off ; axis([-4 4 -4 4]); xlabel( 'In-Phase' ); ylabel( 'Quadrature' ); mod = reshape(mod,Line,[]);
end % IFFT
ifft_func = ifft(mod); figure(4), plot(ifft_func, 'ro' ); title( 'IFFT Function' ); grid off ; axis([-4 4 -4 4]); xlabel( 'In-Phase' ); ylabel( 'Quadrature' );
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% 4. Convert to serial stream for transmission
P2S=reshape(add_CP,1,[]); [rows_add_CP cols_add_CP]=size(P2S); len_ofdm_data = rows_add_CP*cols_add_CP; figure(5), stairs(P2S) title( 'Parallel to Serial Converter' ) axis([0 b -3 3]); xlabel( 'Data Bit' ); ylabel( 'Amplitude' );
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(5) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ;
LAMPIRAN C
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
dengan teknik PTS Modulasi QPSK
clc clear all close all
%% Initializing Parameters % QPSK Modulation = 4QAM constellation % 16QAM Modulation = 16QAM constellation
Bit = input( 'bit = ' ); %Data Masukan Line = 8; %Jumlah Baris Fc = 4e9; %Frekuensi Carrier(Hz) c = 3e8; %m/s v = 3; %Kecepatan Penerima(km/jam) fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
S2P = reshape(gen_data,Line,[]); [a b] = size(S2P);
% Modulasi QPSK
N = Bit/Line; hModulator = comm.QPSKModulator( 'BitInput' , true); hModulator.PhaseOffset = pi/4;
for x = 1:N;
mod(:,x) = step(hModulator,S2P(:,x)); %QPSK Modulation
end %% PTS
V=4; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j]; % QPSK randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data=s(randsrc(1,48,1:4)); ofdm_symbol(i,:)=[data(1:10) pilot(1) data(11:20) pilot(2) data(21:30) pilot(3) data(31:40) pilot(4) data(41:48) unused]; end %save ofdm_4096.mat ofdm_symbol % Semua permutasi fasa faktor B
p=[1 -1 j -j]; % Faktor fasa mungkin B=[];
for b1=1:4 for b2=1:4 for b3=1:4 for b4=1:4
B=[B; [p(b1) p(b2) p(b3) p(b4)]]; % Semua kemungkinan kombinasi
end end end end %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
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);
% Partisi Simbol OFDM
P1=[ofdm_symbol(i,1:16) zeros(1,48)]; P2=[zeros(1,16) ofdm_symbol(i,17:32) zeros(1,32)]; P3=[zeros(1,32) ofdm_symbol(i,33:48) zeros(1,16)]; P4=[zeros(1,48) ofdm_symbol(i,49:64)];
% Ubah Pi ke Domain Waktu
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)]));
% Gabungkan dalam Time Domain dan temukan papr_min
papr_min(i)=papro(i);
for k=1:16 % 16 adalah jumlah kombinasi faktor fase yang mungkin terjadi
final_signal=B(k,1)*Pt1+B(k,2)*Pt2+B(k,3)*Pt3+B(k,4)*Pt4; meank=mean(abs(final_signal).^2); %daya rata-rata peak=max(abs(final_signal).^2); %daya puncak papr=10*log10(peak/meank);
if papr < papr_min(i)
papr_min(i)=papr; sig=final_signal;
end end end % Plot CCDF dari sistem asli dan pts
[cy,cx]=ccdf(papro,0.1); semilogy(cx,cy) hold on [cy,cx]=ccdf(papr_min,0.1); semilogy(cx,cy, 'r' ) grid on title( 'V=4 Modulasi QPSK' ); xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' , 'PTS' )
LAMPIRAN D
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
dengan teknik PTS Modulasi 16QAM
clc clear all close all
%% Initializing Parameters % QPSK Modulation = 4QAM constellation % 16QAM Modulation = 16QAM constellation
Bit = input( 'bit = ' ); %Data Masukan Line = 8; %Jumlah Baris Fc = 4e9; %Frekuensi Carrier(Hz) c = 3e8; %m/s v = 3; %Kecepatan Penerima(km/jam) fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
S2P = reshape(gen_data,Line/2,[]); [a b] = size(S2P);
% Modulasi 16-QAM
dec = bi2de(S2P', 'left-msb' ); M = 16; hMod = modem.qammod(M); mod = modulate(hMod,dec); mod = reshape(mod,Line,[]);
%% PTS
V=4; unused=zeros(1,12); pilot=ones(1,4); s1=[-1-j -1+j 1-j 1+j ,-1-3j -1+3j 1-3j 1+3j,-3-j -3+j 3-j 3+j,-3-3j -3+3j 3-3j 3+3j]; % 16QAM randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data1=s1(randsrc(1,48,1:4)); ofdm_symbol1(i,:)=[data1(1:10) pilot(1) data1(11:20) pilot(2) data1(21:30) pilot(3) data1(31:40) pilot(4) data1(41:48) unused]; end %save ofdm_4096.mat ofdm_symbol % Semua permutasi fasa faktor B
p=[1 -1 j -j]; % Faktor fasa mungkin B=[];
for b1=1:4 for b2=1:4 for b3=1:4 for b4=1:4
B=[B; [p(b1) p(b2) p(b3) p(b4)]]; % Semua kemungkinan kombinasi
end end end end %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
time_domain_signal1=abs(ifft([ofdm_symbol1(i,1:32) zeros(1,(L- 1)*N) ofdm_symbol1(i,33:64)])); meano=mean(abs(time_domain_signal1).^2); peako=max(abs(time_domain_signal1).^2); papro(i)=10*log10(peako/meano);
% Partisi Simbol OFDM
P11=[ofdm_symbol1(i,1:16) zeros(1,48)]; P22=[zeros(1,16) ofdm_symbol1(i,17:32) zeros(1,32)]; P33=[zeros(1,32) ofdm_symbol1(i,33:48) zeros(1,16)]; P44=[zeros(1,48) ofdm_symbol1(i,49:64)];
% Ubah Pi ke Domain Waktu
Pt11=abs(ifft([P11(1:32) zeros(1,(L-1)*N) P11(33:64)])); Pt22=abs(ifft([P22(1:32) zeros(1,(L-1)*N) P22(33:64)])); Pt33=abs(ifft([P33(1:32) zeros(1,(L-1)*N) P33(33:64)])); Pt44=abs(ifft([P44(1:32) zeros(1,(L-1)*N) P44(33:64)]));
% Gabungkan dalam Time Domain dan temukan papr_min
papr_min(i)=papro(i);
for k=1:16 % 16 adalah jumlah kombinasi faktor fase yang mungkin terjadi
final_signal=B(k,1)*Pt11+B(k,2)*Pt22+B(k,3)*Pt33+B(k,4)*Pt44; meank=mean(abs(final_signal).^2); %daya rata-rata peak=max(abs(final_signal).^2); %daya puncak papr=10*log10(peak/meank);
if papr < papr_min(i)
papr_min(i)=papr; sig=final_signal;
end end end % Plot CCDF dari sistem asli dan pts
[cy,cx]=ccdf(papro,0.1); semilogy(cx,cy) hold on [cy,cx]=ccdf(papr_min,0.1); semilogy(cx,cy, 'r' ) grid on title( 'V=4 Modulasi 16QAM' ); xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' , 'PTS' )
LAMPIRAN E
Coding Program dengan software MATLAB 7.11.0 (R2010b) Analisis Reduksi Peak to
Average Power Ratio pada Orthogonal Frequency Division Multiplexing (OFDM)
dengan teknik Clipping Modulasi QPSK
clc clear all close all
%% Parameters OFDM % QPSK Modulation = 4QAM constellation
Bit = input( 'Bit = ' ); %Data Masukan Line=8; Fc = 4e9; % Frekuensi Carrier(Hz) c = 3e8; % m/s fs = 30e3; tsamp = 1/(fs);
%% Transmitter % Membangkitkan Data Bit Secara Acak
gen_data = randint(1,Bit);
% Serial To Parallel Converter
S2P = reshape(gen_data,Line,[]); [a b] = size(S2P);
% Modulasi QPSK
N = Bit/Line; hModulator = comm.QPSKModulator( 'BitInput' , true); hModulator.PhaseOffset = pi/4;
for x = 1:N;
mod(:,x) = step(hModulator,S2P(:,x)); %QPSK Modulation
end % IFFT
ifft_func = abs(ifft(mod));
% Cyclic Prefix
Ncp = 2; %Number of cyclic prefix add_CP=[ifft_func(:,end-Ncp+1:end) ifft_func];
% Parallel To Serial Converter
P2S=reshape(add_CP,1,[]); [rows_P2S cols_P2S]=size(P2S); len_ofdm_data = rows_P2S*cols_P2S;
% Actual OFDM signal to be transmitted
ofdm_signal = reshape(P2S, 1, len_ofdm_data); figure(3) plot(real(ofdm_signal)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'OFDM Signal' );grid on ; unused=zeros(1,12); pilot=ones(1,4); s=[-1-j -1+j 1-j 1+j]; % QPSK randn( 'state' , 12345);
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data2=s(randsrc(1,48,3:4)); ofdm_symbol2(i,:)=[data2(1:10) pilot(1) data2(11:20) pilot(2) data2(21:30) pilot(3) data2(31:40) pilot(4) data2(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
time_domain_signal2=abs(ifft([ofdm_symbol2(i,1:32) zeros(1,(L- 1)*N) ofdm_symbol2(i,33:64)])); mean2=mean(abs(time_domain_signal2).^2); peak2=max(abs(time_domain_signal2).^2); papr2(i)=10*log10(peak2/mean2);
end
figure(6) [cy,cx]=ccdf(papr2,0.1); semilogy(cx,cy, 'r' ); grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Clipping original' )
%% Clipping Reduction % Clipping CR=0.8
sigout1= add_CP (1,:); jum_sigout1=sum(sigout1); avg1=jum_sigout1/512;
% Hitung standar deviasi
krg1=sigout1-avg1; pkt1=krg1.^2; bgi1=pkt1./512; dev1=sqrt(sum(bgi1));
% Mencari Clipping Level
CR1=0.8; A1=CR1*dev1; clipped=ofdm_signal;
for i=1:length(clipped) if clipped(i) > A1
clipped(i) = A1;
end if clipped(i) < -A1 clipped(i) = -A1;
end end
figure(7) plot(real(clipped)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'clipped Signal 1' );grid on ;
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data=s(randsrc(1,48,1:4)); ofdm_symbol(i,:)=[data(1:10) pilot(1) data(11:20) pilot(2) data(21:30) pilot(3) data(31:40) pilot(4) data(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
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);
end
figure(8) [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ); grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Clipping 1' )
% Clipping CR=2
sigout2=add_CP(1,:); jum_sigout2=sum(sigout2); avg2=jum_sigout2/512;
% Hitung standar deviasi
krg2=sigout2-avg2; pkt2=krg2.^2; bgi2=pkt2./512; dev2=sqrt(sum(bgi2));
% Hitung clipping level
CR2=2; A2=CR2*dev2; clipped1=ofdm_signal;
for i=1:length(clipped1) if clipped1(i) > A2
clipped1(i) = A2; end if clipped1(i) < -A2
clipped1(i) = -A2;
end end
figure(9) plot(real(clipped1)); xlabel( 'Time' ); ylabel( 'Amplitude' ); title( 'clipped Signal 2' );grid on ;
for i=1:4096 % Menghasilkan simbol 4096 OFDM
data1=s(randsrc(1,48,2:4)); ofdm_symbol1(i,:)=[data1(1:10) pilot(1) data1(11:20) pilot(2) data1(21:30) pilot(3) data1(31:40) pilot(4) data1(41:48) unused];
end %save ofdm_4096.mat ofdm_symbol %load ofdm_4096.mat
NN=4096; N=64; % Jumlah subbands L=4; % oversampling factor
for i=1:NN % Hitung papr dari original ofdm
time_domain_signal1=abs(ifft([ofdm_symbol1(i,1:32) zeros(1,(L- 1)*N) ofdm_symbol1(i,33:64)])); mean1=mean(abs(time_domain_signal1).^2); peak1=max(abs(time_domain_signal1).^2); papr1(i)=10*log10(peak1/mean1);
end
figure(10) [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy, 'C' ) grid on xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Clipping Original' )
% Plot CCDF dari sistem asli dan clipping
figure(11) [cy,cx]=ccdf(papr2,0.1); semilogy(cx,cy, 'r' ) hold on [cy,cx]=ccdf(papro,0.1); semilogy(cx,cy, 'g' ) hold on [cy,cx]=ccdf(papr1,0.1); semilogy(cx,cy, 'C' ) grid on title( 'Clipping Reduction with QPSK' ); xlabel( 'PAPR0(dB)' ); ylabel( 'CCDF(P[PAPR>PAPR0)' ); legend( 'Original' , 'Clipping1' , 'Clipping2' )