1.软件版本
MATLAB2021a
2.核心代码
for ii = 1:length(CFO)
for n = 1:length(EbN0dB)
snr = EbN0dB(n);
berrors = 0;tic;
for mc = 1:MC
x = rand(1,nDSC)>0.5;
xt = 2*x -1;
xt = (nFFT/sqrt(nDSC))*ifft(fftshift(xt),nFFT);
xtt = [xt(end-nCP+1:end) xt];
% Gaussian noise of unit variance, 0 mean
nt = 1/sqrt(2)*(randn(1,nTot) + 1i*randn(1,nTot));
yr = sqrt(nTot/nFFT)*xtt + 10^(-EsN0dB(n)/20)*nt;
% applying CFO
yr =(exp(1i*2*pi*CFO(ii)*(0:length(yr)-1)/nFFT)).*yr;
% Receiver processing
yr = yr(nCP+1:end);
yr = (nDSC/sqrt(nFFT))*fftshift(fft(yr,nFFT));
yr = yr > 0; % hard demodulation
berrors = berrors + length(find((yr-x)~=0));
end
toc;
BER(ii,n) = berrors/(nFFT*MC);
end
end
3.操作步骤与仿真结论
D218
标签:AWGN,end,OFDM,sqrt,berrors,频偏,nFFT,yr,xt
From: https://www.cnblogs.com/matlabfpga/p/16929325.html