# How to calculate BER vs. SNR in ACO-OFDM system over VLC channel?

16 visualizzazioni (ultimi 30 giorni)
Haitham AL Satai il 11 Set 2022
I am trying to calculate BER vs. SNR performance of LS and MMSE aided channel estimation algorithms in ACO-OFDM system over VLC channel in order to get the result like in the figure below
but unfortunately, I always find an error in calculation for example the error below
Error using modulate
Not enough input arguments.
clear all;
close all;
m = 512;
N = 1024;
M = 4;
pilotFrequency = 8;
E = 2;
Ncp = 256;
Data=randi([0 M-1],m,N);
Tx = qammod(Data,M);
Rx = qamdemod(Data,M);
for k1 = 1:m
for m1=1:N
if mod(m1,2)==0
Data(k1,m1)=0;
end
end
end
DataMod = modulate(Tx,Data);
DataMod_serialtoparallel = DataMod.';
PLoc = 1 : pilotFrequency: N;
DLoc=setxor(1:N, PLoc);
DataMod_serialtoparallel(PLoc,:)= E*DataMod_serialtoparallel(PLoc,:);
datamat=DataMod_serialtoparallel;
datamat(1,:)=0;
datamat(513,:)=0;
datamat(514:1024,:)=flipud(conj(datamat(2:512,:)));
d_ifft=ifft((datamat));
for k2=1:N
for m2=1:m
if( d_ifft(k2,m2)<0)
d_ifft(k2,m2)=0;
end
end
end
d_ifft_paralleltoserial=d_ifft.';
CP_part=d_ifft_paralleltoserial(:,end -Ncp+1: end);
ACOOFDM_CP = [CP_part d_ifft_paralleltoserial];
theta = 70; %LED semi - angle
ml=-log10(2)/log10(cos(theta));
APD=0.01;
lx=5;ly=5;lz=3;
h =2.15;
[XT,YT]= meshgrid([-lx/4 lx/4],[-ly/4 ly/4]);
Nx=lx*5; Ny=ly*5;
x = linspace(-lx/2,lx/2,Nx);
y = linspace(-ly/2,ly/2,Ny);
[XR,YR] = meshgrid(x,y);
D1=sqrt((XR-XT(1,1)).^2+(YR-YT(1,1)).^2+h^2);
D2=sqrt((XR-XT(2,2)).^2+(YR-YT(2,2)).^2+h^2);
cosphi_A1=h./D1;
H_A1 = 3600*((ml+1)*APD.*cosphi_A1.^(ml+1)./(2*pi.*D1.^2)+(ml+1)*APD.*cosphi_A1.^(ml+1)./(2*pi.^2*D1.^2*D2.^2));
H_A2 = H_A1./norm(H_A1);
d_channell = filter(H_A2(1,1:2), 1, ACOOFDM_CP.').';
count=0;
snr_vector=0:1:30;
for snr=snr_vector
SNR=snr+10*log10(log2(M));
count=count+1;
ACOOFDM_with_chann=awgn(d_channell,SNR,'measured ') ;
ACOOFDM_removal_CP=ACOOFDM_with_chann(:,Ncp+1:N+Ncp);
ACOOFDM_serialtoparallel=ACOOFDM_removal_CP.';
ACOOFDM_parallel_fft=fft(ACOOFDM_serialtoparallel) ;
TransmittedPilots=DataMod_serialtoparallel(PLoc,:);
for r=1:m
end
for q=1:m
HData_LS(:,q)=interpolate(H_LS(:,q).',PLoc,N,'spline ');
end
HData_LS_parallel1=HData_LS.';
HData_MMSE_parallel1=H_MMSE.';
ACOOFDM_SERIAL_LS=demodulate(Rx,(ACOOFDM_parallel_fft.') ./HData_LS_parallel1);
ACOOFDM_SERIAL_MMSE=demodulate(Rx,(ACOOFDM_parallel_fft.') ./(HData_MMSE_parallel1));
Data_no_pilots=Data(:,DLoc);
Recovered_Pilot_LS=ACOOFDM_SERIAL_LS(:,DLoc);
Recovered_Pilot_MMSE=ACOOFDM_SERIAL_MMSE(:,DLoc);
[~,recoveredLS(count)]=biterr(Data_no_pilots(:,2:255),Recovered_Pilot_LS(:,2:255));
[~,recoveredMMSE(count)]=biterr(Data_no_pilots(:,2:255),Recovered_Pilot_MMSE(:,2:255));
end
semilogy(snr_vector,recoveredLS,'rd-','LineWidth ' ,2);
holdon;
semilogy(snr_vector,recoveredMMSE,'gs-','LineWidth ',2);
axis([0 30 10^-4 1]);
grid on;
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Hanojhan Rajahrajasingh il 7 Feb 2023
Did you find a solution to this problem?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Haitham AL Satai il 7 Feb 2023
Not yet.

Accedi per commentare.

### Categorie

Scopri di più su Test and Measurement in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by