6 - Performance Results Via Simulation

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Performance Results via Simulation

Section Overview Using Simulated Data to Compute Bit and Symbol Error Rates Example: Computing Error Rates Comparing Symbol Error Rate and Bit Error Rate

Section Overview
One way to compute the bit error rate or symbol error rate or a communication system is to simulate the transmission o data messages and compare all messages be ore and a ter transmission! "he simulation o the communication system components using Communications "oolbox is covered in other parts o this guide! "his section describes how to compare the data messages that enter and leave the simulation! #nother example o computing per ormance results via simulation is in Curve $itting or Error Rate %lots in the discussion o curve itting!

Using Simulated Data to Compute Bit and Symbol Error Rates


"he biterr unction compares two sets o data and computes the number o bit errors and the bit error rate! "he symerr unction compares two sets o data and computes the number o symbol errors and the symbol error rate! #n error is a discrepancy between corresponding points in the two sets o data! O the two sets o data& typically one represents messages entering a transmitter and the other represents recovered messages leaving a receiver! 'ou might also compare data entering and leaving other parts o your communication system& or example& data entering an encoder and data leaving a decoder! ( your communication system uses several bits to represent one symbol& counting bit errors is di erent rom counting symbol errors! (n either the bit) or symbol)counting case& the error rate is the number o errors divided by the total number *o bits or symbols+ transmitted!

Note "o ensure an accurate error rate& you should typically simulate enough data to produce at least ,-- errors!

( the error rate is very small * or example& ,-). or smaller+& the semianalytic techni/ue might compute the result more /uic0ly than a simulation)only approach! See %er ormance Results via the Semianalytic "echni/ue or more in ormation on how to use this techni/ue!

E ample! Computing Error Rates


"he script below uses the symerr unction to compute the symbol error rates or a noisy linear bloc0 code! # ter arti icially adding noise to the encoded message& it compares the resulting noisy code to the original code! "hen it decodes and compares the decoded message to the original one!
m = 3; n = 2^m-1; k = n-m; % Prepare to use Hamming code. msg = randint(k*2 !1!2"; % 2 messages o# k bits eac$ code = encode(msg!n!k!%$amming%"; codenoisy = rem(code&(rand(n*2 !1"'.()"!2"; % *dd noise. % +ecode and correct some errors. ne,msg = decode(codenoisy!n!k!%$amming%"; % -ompute and disp.ay symbo. error rates. /codenum!coderate0 = symerr(code!codenoisy"; /msgnum!msgrate0 = symerr(msg!ne,msg"; disp(/%1rror rate in t$e recei2ed code3 %!num2str(coderate"0" disp(/%1rror rate a#ter decoding3 %!num2str(msgrate"0"

"he output is below! "he error rate decreases a ter decoding because the 1amming decoder corrects some o the errors! 'our results might vary because this example uses random numbers!
1rror rate in t$e recei2ed code3 1rror rate a#ter decoding3 . 3 . )4256

Comparing Symbol Error Rate and Bit Error Rate


(n the example above& the symbol errors and bit errors are the same because each symbol is a bit! "he commands below illustrate the di erence between symbol errors and bit errors in other situations!
a = /1 2 30%; b = /1 4 40%; #ormat rat % +isp.ay #ractions instead o# decima.s. /snum!srate0 = symerr(a!b" /bnum!brate0 = biterr(a!b"

"he output is below!

snum = 2 srate = 273 bnum = ) brate = )7( bnum is 2 because the second entries di er in two bits and the third entries di er in three bits! brate is 234 because the total number o bits is 4! "he total number o bits is& by de inition& the number o entries in a or b times the maximum number o bits among all entries o a and b!

You might also like