# Computing overall bitrate of a transmitter with a two chunks package

I'm programming a digital communication system in MATLAB and I have a two chunk package, let's say a header and a body, and I'm using a different channel code for each chunk, i. e. BHC1 and BCH2. But because I'm using the same modulation for both chunks,

Rs = n_symbols / (n_symbols * n_symbol_samples / Fs) = Fs / n_symbol_samples


is the same. Computing Rc, I obtain

Rc = Rs * log2(M)


Hence,

R1 = Rc * BCH1_rate
R2 = Rc * BCH2_rate.


How can I compute an overall bitrate R for my system if I'm a sending this package composed of two chunks with differents channel codes?

Don't use fancy calculations which merely muddle up the problem. The header is $K$ bits where $K = Lk_1$; the body is $M$ bits where $M = Nk_2$. You are using a $[n_1, k_1]$ code to transmit the header which you do by dividing the $K$ bits of the header into $L$ chunks of $k_1$ bits each, encoding them, and thus sending $L$ codewords of length $n_1$ bits each. Total number of channel bits $= Ln_1$. Similarly, you send a total of $Nn_2$ channel bits ($N$ codewords of length $n_2$ each) giving a grand total of $Ln_1+Nn_2$ channel bits to send the $Lk_1+Nk_2$ "data" bits in the header and body. So, the overall rate of the scheme is $$R = \frac{Lk_1+Nk_2}{Ln_1+Nn_2}.$$ But be aware that some people refuse to acknowledge the information in the header as data and insist that actually only $Nk_2$ data bits are being transmitted; everything else is overhead. For these folks, the rate would be just $$R = \frac{Nk_2}{Ln_1+Nn_2}.$$