# Optimization of Bit Allocation for Spatial Multiplexing in MIMO VLC System with Smartphones
## 3 WF-Based Bit Allocation  
To apply MIMO VLC techniques in mobile devices, the design of the power allocation techniques needs to consider the truth of the system and channel. Moreover, the configurations of optical components (displays and cameras) almost controlled by an operating system (BIOS or firmware) may change the channel conditions. These kinds of instability may cause gaps in power allocation between the simulation and the practical test. Instead of power or energy values used in the simulation [17], bits are more feasible for the effective design of modulation to satisfy the requirements of digital communication in real MIMO VLC systems. Therefore, the objective and subjective formulations in the optimization of power allocation need to be modified in terms of bits. Based on the prototype of the WF algorithm, the proposed bit allocation for the MIMO VLC system can allocate more bits in better channels, and fewer bits for the worse channels. Following the results of the bit allocation, the design of the precoder in the transmitter and the equalizer in the receiver are simultaneously adjusted for all channels. Thus, \(M\)-PAM can be realized with  
Figure 5: Paradigms of power allocation with (**a**) GA for one-by-one channel selection and (**b**) WF scheme for all channels with equal energy levels. the assigned bits in each channel. Moreover, optimization can be achieved by maximizing the channel diversity in the MIMO VLC system. Similar to the optimization of transmission efficiency, the BER reduction is more feasible with the constraints of a fixed number of total bits transmitted in MIMO channels. Therefore, the goal of bit allocation for the design of precoding and equalization can be equivalent to the minimization of the error rate with a fixed total transmission rate. The objective and subjective functions for the scenario with \(N\) channels are respectively expressed as:  
\[\min\biggl{\{}\frac{1}{N}\sum_{k=1}^{N}\frac{I_{k}}{2\times\ 2^{R_{k}}}\biggr{\}} \tag{9}\]  
and  
\[\sum_{k=1}^{N}R_{k}=NR \tag{10}\]  
where \(I_{k}\) is the maximum grayscale in the \(k\)-th channel, \(R\) is the expected transmission rate per channel, and \(\frac{x_{k}}{2\times 2^{R_{k}}}\) is the expected value of noise energy, as discussed in [24]. The Lagrangian equation \(L(R,\lambda)\) can be formulated as:  
\[\frac{1}{N}\sum_{k=1}^{N}\biggl{(}\frac{I_{k}}{2*2^{R_{k}}}\biggr{)}+\frac{ \lambda}{N}\biggl{(}\sum_{k=1}^{N}R_{k}-NR\biggr{)} \tag{11}\]  
where \(R\) = (\(R_{1}\),\(R_{2}\),..., \(R_{N}\)) is the set of transmission rates for all channels. The error minimization can be solved by the following steps. **Step 1:** Provide a Lagrange multiplier \(\lambda\) to enforce the expected number of transmission rates;  
**Step 2:** Find the differentiation for each \(R_{k}\) and \(\lambda\);  
**Step 3:** Solve the derived equation for each \(R_{k}\) and then enforce the average transmission rate to fit the power constraint. The first differentiations of the Lagrangian in terms of \(R_{k}\) and \(\lambda\) with respect to zeros can be (12) and (13), respectively. \[\frac{\partial}{\partial R_{k}}\biggl{\{}\frac{1}{N}\sum_{k=1}^{N}\biggl{(} \frac{I_{k}}{2*2^{R_{k}}}\biggr{)}+\frac{\lambda}{N}\biggl{(}\sum_{k=1}^{N}R_{ k}-NR\biggr{)}\biggr{\}}=0,\forall\in\{1,\ldots,N\} \tag{12}\]  
\[\frac{\partial}{\partial\lambda}\biggl{\{}\frac{1}{N}\sum_{k=1}^{N}\biggl{(} \frac{I_{k}}{2*2^{R_{k}}}\biggr{)}+\frac{\lambda}{N}\biggl{(}\sum_{k=1}^{N}R_{ k}-NR\biggr{)}\biggr{\}}=0 \tag{13}\]  
These equations can provide the solution of the minimum transmission error by finding an appropriate set \(\mathbf{R^{\prime}}\) of power (rates) allocation \(\{R^{\prime}_{k}\ |\ k=1,\ldots,N\}\).