Can anyone explain what is happening in the AGWN channel section to the R section of this code for me? I am really confused

2 visualizaciones (últimos 30 días)
clc
clear
close all
% ofdm transceiver
N = 128; % number of subcarriers
M = 20; % number of ofdm blocks
CP1 = N/8; % CP length system 1
CP2 = N/16; % CP length system 2
sigma = 0;
% Input data
data_in_1 = sign(randn(N,M));
data_in_1(N/2+1:end,:) = 0;
data_in_2 = sign(randn(N,M));
data_in_2(1:N/2,:) = 0;
% OFDM Tx
ofdm_sig1 = ifft(data_in_1);
ofdm_sig2 = ifft(data_in_2);
% CP insertion
cp_ofdm_sig1 = [ofdm_sig1(N-CP1+1:N,:); ofdm_sig1];
cp_ofdm_sig2 = [ofdm_sig2(N-CP2+1:N,:); ofdm_sig2];
% AWGN Channel
noise = sigma*(randn(size(cp_ofdm_sig1))+1i*randn(size(cp_ofdm_sig1)));
r = cp_ofdm_sig1(:).'+ [cp_ofdm_sig2(:).' zeros(1,M*(CP1-CP2))];
r = reshape(r,CP1+N,M);
% OFDM Rx
% CP removal
ofdm_sig_rx = r(CP1+1:end,:);
data_out = sign(real(fft(ofdm_sig_rx)));
% Errors
z = (data_out(1:N/2,:)~=data_in_1(1:N/2,:));
error_number = sum(z(:));
error_rate = error_number / ((N/2)*M)
% hist(real(noise(:)),100)

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by