Error on BER vs SNR for ACO-OFDM when apply zero clipping

7 ビュー (過去 30 日間)
norzalina Othman
norzalina Othman 2024 年 2 月 1 日
回答済み: nick 2024 年 2 月 29 日
Could anyone help me how to rectify this problem as I facing a difficulties in generating a correct out of BEr vs SNR for ACO-OFDM program as the graph plotted in linear line. The ACO-OFDM program as follows:
N = 20; % Number of rows in the array
m = 10; % Number of columns in the array
M = 64; %constellation size --> M=4/8/16/32/64/128/256
Ncp=5;
%Generation of random bits matrix of size m x N
Data_new = randi([0 1],m,N);
Data_ACO = Data_new;
%ACO-OFDM Principle (Only apply on odd sc
for x=1:m %m=row
for y=1:N %N=column
if mod(y,2)==0 %perform modulas operator to find even sc
Data_ACO(x,y)=0;%set even sc to 0
end
end
end
disp(Data_ACO);
%Performing data modulation
DataQAM_ACO = qammod(Data_ACO, M);
disp(DataQAM_ACO);
DataMat_ACO = DataQAM_ACO.';
%Apply HS on N-Sc
DataMat_ACO(1,:)=0;
DataMat_ACO(11,:)=0;
DataMat_ACO(12:20 , :)=flipud(conj (DataMat_ACO (2:10,:)));
%IFFT computational
ACO_IFFT = ifft(DataMat_ACO);
ACO_IFFT_P2S = ACO_IFFT2.';
%Zero Clipping
ZeroClip_ACO=ACO_IFFT_P2S;
for row=1:m
for col=1:N
if(ACO_IFFT_P2S(row,col)<0)
ZeroClip_ACO(row,col)=0;
end
end
end
P_Part_ACO = ZeroClip_ACO(:,end - Ncp + 1:end);
CP_ACO = [CP_Part_ACO ZeroClip_ACO];
%--------------------------------------------------------------------------------------
% Optical Channel
%-------------------------------------------------------------------------------------
count=0;
snr_vector=0:1:18;
for snr=snr_vector
SNR_ACOOFDM = snr + 10 * log10 (log2 (M));
count=count + 1;
ACO_OFDM_Channel = awgn(CP_ACO, SNR_ACOOFDM, 'measured'); %add AWGN
ACO_CP_removal = ACO_OFDM_Channel(:,Ncp+1:N+Ncp);
ACO_Rx_S2P = ACO_CP_removal.';
%FFT computational (TD - FD)
ACO_Rx_FFT = fft(ACO_Rx_S2P);
ACO_Rx_P2S = ACO_Rx_FFT.';
%QAM Demodulation
ACO_Demod = qamdemod(ACO_Rx_P2S, M);
[~,bit_errorACO(count)] = biterr (Data_ACO(:,2:10), ACO_Demod(:,2:10));
end
Thanks in advanced.

回答 (1 件)

nick
nick 2024 年 2 月 29 日
Hello Norzalina,
I understand that you're looking to create a graph of BER vs. SNR for ACO-OFDM program, as illustrated in the image you've provided.
I noticed a few typographical errors in the variable names within the code you shared:
  • In the IFFT computation, the variable should be 'ACO_IFFT' instead of 'ACO_IFFT2' when calculating 'ACO_IFFT_P2S'. Here is the corrected segment:
% IFFT computation
ACO_IFFT = ifft(DataMat_ACO);
ACO_IFFT_P2S = ACO_IFFT.'; % corrected 'ACO_IFFT2' to 'ACO_IFFT'
  • In the Zero Clipping section, the variable name should be 'CP_Part_ACO' rather than 'P_PART_ACO', as shown below:
% Zero Clipping
ZeroClip_ACO = ACO_IFFT_P2S;
for row = 1:m
for col = 1:N
if ACO_IFFT_P2S(row, col) < 0
ZeroClip_ACO(row, col) = 0;
end
end
end
CP_Part_ACO = ZeroClip_ACO(:, end - Ncp + 1:end); % corrected 'P_Part_ACO' to 'CP_Part_ACO'
CP_ACO = [CP_Part_ACO ZeroClip_ACO];
After implementing these changes, here is the resulting BER vs. SNR graph:
Hope this helps.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by