Well,
(1)
These are not steps, these are auxiliary variables for the formula.
I am doing it so, because it was writen in the book so. Of coures you can do it in one step.
Maybe the book uses this auxiliary variable because it would be too long formula to write it in one or two line.
2)
Well, I can only assume, the formula calculates SER with Gray coding. I used Gray coding in my simulation and the two curve was pretty the same.
2,5) gs this stands for average SNR refering to symbol, average Esimbol/No,
the formula needs this Average SNR refering to simbol input, but I wanted to plot the results in the average SNR refering to bit scale
so first I generated average SNR refering to bit values from 0 to 40 in decibels.
Then I had to convert it to Average SNR refering to simbol
Average SNR refering to simbol=k*average SNR refering to bit, where k is the number of the bits carried by a simbol. the formula for k is in the code above.
but this formula is only aplicable if you calculate it with real numbers, not decibels. so, i had to convert decibel values to real numbers first.
x[real]=10^(x[dB]/10) if you are refering to powers, and here we are refering to power
in the row in my code i solved 2 thing in one row i changed from decibels to real numbers, and multiplied with k, to get SNR(simbol) from SNR(bit)
this step has nothing to do with Gray coding.
this code only calculates the formula found in a book for some SNR values.
As I mentioned above, I do a simulation myself too. I ran my simulation counting bit error, and counting simbol error. If I am counting simbol error, I get much the same digram, which i get from this program. If I measure bit errors, I get the same results as Matlab Bertool. (My teacher looked a little bit deeper into matlab, and turnd out matlab bertool uses this formula too
)
3)
the source of the formula Giovannie E. Corazza, “Digital Satellite Communications”, Springer 2007 ISBN:0-387-25634-2
---------- Post added at 05:03 ---------- Previous post was at 04:58 ----------
for 2,5) The formula needs the average SNR refering to simbol input in real numbers,so this value is intentional not converted back to decibels.