bits transmitted and received are the same even though i added the noise?
Show older comments
hello everyone, i am working on BER in OFDM.as i checked through variable editor in matlab,the bits transmitted and received are the same even though i added the noise.below is part of the code.can anyone help?
dataType = '16QAM'; % Modulation format.
totalSubcarriers = 64; % Number of total subcarriers.
numSymbols = 16; % Data block size.
Fs = 5e6; % System bandwidth.
Ts = 1/Fs; % System sampling rate.
Nos = 4; % Oversampling factor.
Nsub = totalSubcarriers;
Fsub = [0:Nsub-1]*Fs/Nsub; % Subcarrier spacing
numRuns = 1000; % Number of runs.
M=16;
s=log2(M);
EbN0dB = [0:16];
EsN0dB = EbN0dB + 10*log10(s);
for ii = 1:length(EbN0dB)
for n = 1:numRuns,
% Generate random data.
if dataType == '16QAM'
ipBit = randint(1,numSymbols,M);
ipBit = ipBit.';
%Data Modulation
ipMod = (1/sqrt(10))*qammod(ipBit,M);
end
% Time range of the OFDM symbol.
t = [0:Ts/Nos:Nsub*Ts];
% OFDM modulation.
for k = 1:numSymbols,
y= ipMod(k)*exp(j*2*pi*Fsub(k)*t);
%adding gaussian noise
nt = [randn(1,257)+ i*randn(1,257)];
yt = y + 10^(-EsN0dB(ii)/20)*nt;
%receiver
data_rx= yt.*exp(-j*2*pi*Fsub(k)*t);
data_rx = data_rx(:,1);
end
ipBitHat = qamdemod(data_rx*sqrt(10),M);
end
end
Answers (1)
Walter Roberson
on 18 Apr 2013
0 votes
You are overwriting data_rx on each iteration of the "for k" loop.
2 Comments
f2t1
on 18 Apr 2013
Walter Roberson
on 18 Apr 2013
Why are you calculating noise per symbol? Is there a separate channel for each symbol? You should be adding noise to each channel once the waveform for the channel has been calculated.
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!