Understanding the ErrorRate in mod/demod system
Show older comments
I'm doing a mod/demod simulation in MatLab, the algorith works fine, but i'm having difficulty to understand the error in the tranmission of the data. The algorithm does 100 iterations, on each iteration it's simulated the transmission of a random word of 100-bit lenght GMSK modulated with a white noise, then this data is demodulated and the error is calculated based on the delay. Below de the entire code:
%Creates a MOD/DEMOD GMSK and the White Noise (AWGN)
hMod = comm.GMSKModulator('BitInput', true, 'InitialPhaseOffset', pi/4);
hAWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',0);
hDemod = comm.GMSKDemodulator('BitOutput', true,'InitialPhaseOffset', pi/4);
% Calculate the error based on the delay caused by the Viterbi Algorithm
hError = comm.ErrorRate('ReceiveDelay', hDemod.TracebackDepth);
for counter = 1:100
% Transmit 100 words of 100-bits each
data = randi([0 1],100,1);
modSignal = step(hMod, data);
noisySignal = step(hAWGN, modSignal);
receivedData = step(hDemod, noisySignal);
errorStats = step(hError, data, receivedData);
fprintf('Iteration: %d\n',counter);
fprintf('Error Rate = %f\nNumber of Errors = %d\n',errorStats(1), errorStats(2));
if errorStats(2) >= 1;
subplot(4,1,1);
plot(data); axis ([1 100 -2 2]);
title('Data Transmissed');
subplot(4,1,2);
plot(receivedData); axis ([1 100 -2 2]);
title('Dado Received');
subplot(4,1,3);
plot(modSignal);
title('Modulated Signal');
subplot(4,1,4);
plot(noisySignal);
title('Modulated Signal with AWGN');
end
end
How can I see the numbers of erros in the plot? Because even when an error appears the received data seems to be correct. I know that the error rate is calculated based on the delay, and the number of errors is the number of different bits between the transmited and received data.
Answers (0)
Categories
Find more on Modulation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!