The following code is not running properly can someone help me out?

% Initializing Simulation

%rng(10,'twister');

N = 8*(10^5); %Number of monte carlo simulations

a1 = 0.1; % power coefficient

a2 = 0.9; % UE2 power coefficient

pktLen= N; %packet length

EbNo = (-10:1:10); %

M = 4; % QPSK modulation order

bps = log2(M); % Bits per symbol

numSC = 144; % Number of OFDM subcarriers

numSymOFDM=7; %Number of OFDM symbols

maxBitErrors = 100; % Maximum number of bit errors

maxNumBits = 1e7; % Maximum number of bits transmitted

%Create OFDM modulator and demodulator system objects

ofdmMod = comm.OFDMModulator('FFTLength',numSC, 'NumSymbols', numSymOFDM);

ofdmDemod = comm.OFDMDemodulator('FFTLength',numSC, 'NumSymbols', numSymOFDM);

ofdmDims = info(ofdmMod);

numDC = ofdmDims.DataInputSize(1);

frameSize = [bps*numDC 1];

%Create turbo code object

intrlvrIndices = randperm(frameSize(1));

hTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, ...

[13 15 17],13),'InterleaverIndices',intrlvrIndices);

% Create turbo decoder system object

hTDec = comm.TurboDecoder('TrellisStructure',poly2trellis(4, ...

[13 15 17],13),'InterleaverIndices',intrlvrIndices, ...

'NumIterations',8);

% QPSK modulator and demodulator system objects

qpskmod = comm.QPSKModulator('BitInput',true);

qpskDemodulator = comm.QPSKDemodulator('BitOutput',true);

% Snr

snrVec = EbNo + 10*log10(bps) + 10*log10(numDC/numSC);

% Create 6-Path Rayleigh fading channel

rayChan = comm.RayleighChannel('SampleRate',2.5e6, 'PathDelays',[0 0.83e-6 1.66e-6 2.49e-6 3.32e-6 4.15e-6], 'AveragePathGains',[0, -3, -6, -9, -12, -15] );

% Create an AWGN channel object and an error rate counter.

channel = comm.AWGNChannel('EbNo',EbNo,'BitsPerSymbol',2);

%Initialize the bit error rate vector and error rate.

ber = zeros(size(EbNo));

errorRate = comm.ErrorRate;

% error stat

errorStats = zeros(1,3);

%Processing loop

for k = 1:length(EbNo)

snr = snrVec(k);

while errorStats(2)

More Buhari Shehu's questions See All
Similar questions and discussions