# Linear Precoding Designs for MIMO VLC Using Multi-Color LEDs under Multiple Lighting Constraints
## 4 Linear Precoding Design  
In this section, we propose a linear precoding design based on an iterative optimization method. After transforming the non-convex optimization problem into a convex problem, the optimal precoder can be derived under multiple lighting constraints. To solve the minimizing Problem (23), we set the gradient \(\partial\mathbf{MSE}/\partial\mathbf{W}=\mathbf{0}\), so it follows that the optimal \(\mathbf{W}^{*}\) is [27]:  
\[\mathbf{W}^{*}=\mathbf{R}_{x}\mathbf{F}^{T}\mathbf{H}^{T}\left(\mathbf{H} \mathbf{F}\mathbf{R}_{x}\mathbf{F}^{T}\mathbf{H}^{T}+\mathbf{R}_{z}\right)^{- 1}. \tag{24}\]  
It could be observed that the optimal \(\mathbf{W}^{*}\) is only dependent on \(\mathbf{F}\) since both \(\mathbf{R}_{x}\) and \(\mathbf{R}_{z}\) are given. Here, we use the transformations \(\mathrm{Tr}\left(\mathbf{A}\mathbf{B}\right)=\mathrm{Tr}\left(\mathbf{B} \mathbf{A}\right)\) and \(\mathrm{Tr}\left(\mathbf{X}^{T}\mathbf{Y}\mathbf{X}\mathbf{G}\right)=\mathrm{ vec}\left(\mathbf{X}\right)^{T}\left(\mathbf{G}^{T}\otimes\mathbf{Y}\right) \mathrm{vec}\left(\mathbf{X}\right)\); the first item of Equation (9) can be rewritten as [28]:  
\[ \begin{array}{l}\mathrm{Tr}\left(\mathbf{W}\mathbf{H}\mathbf{F}\mathbf{R}_{x }\mathbf{F}^{T}\mathbf{H}^{T}\mathbf{W}^{T}\right)\\ =\mathrm{Tr}\left(\mathbf{F}\mathbf{R}_{x}\mathbf{F}^{T}\mathbf{H}^{T}\mathbf{ W}^{T}\mathbf{W}\mathbf{H}\right)\\ =\mathrm{vec}\left(\mathbf{F}^{T}\right)^{T}\left[\left(\mathbf{H}^{T}\mathbf{ W}^{T}\mathbf{W}\mathbf{H}\right)\otimes\mathbf{R}_{x}\right]\mathrm{vec}\left( \mathbf{F}^{T}\right).\end{array}  \tag{25}\]  
For a fixed \(\mathbf{F}\), the optimal \(\mathbf{W}^{*}\) can be seen as a known matrix. After the value of matrix \(\mathbf{W}\) is given, Equation (25) is obviously a quadratic item related to \(\mathbf{F}\). Meanwhile, the items \(\mathrm{Tr}\left(\mathbf{W}\mathbf{H}\mathbf{F}_{x}\right)\) and \(\mathrm{Tr}\left(\mathbf{R}_{x}\mathbf{F}^{T}\mathbf{H}^{T}\mathbf{W}^{T}\right)\) in Equation (9) are linear with \(\mathbf{F}\), while \(\mathrm{Tr}\left(\mathbf{R}_{x}\right)\) and \(\mathrm{Tr}\left(\mathbf{W}\mathbf{R}_{z}\mathbf{W}^{T}\right)\) are constant. Thus, the objective function is convex with respect to \(\mathbf{F}\). Finally, the main optimization Problem (23) with fixed \(\mathbf{W}\) is rewritten as:  
\[ \begin{split}\underset{\mathbf{F},\mathbf{d}}{\text{min}}& \mathbf{MSE}=\text{Tr}\left(\mathbf{R}_{E}\right)\\ \text{s.t.}&\text{abs}\left(\mathbf{F}\right) \mathbf{\Delta}\leq\min\left(\mathbf{d},\mathbf{A}_{Dm}\otimes\mathbf{1}_{N_{ t}\times 1}-\mathbf{d}\right),\\ &\left|\mathbf{E}_{j}\mathbf{L}\right|_{1}=L_{t},\,\forall j=1,2,\cdots,N_{t},\\ &\mathbf{G}\boldsymbol{\gamma}_{j}\leq\mathbf{0},\,\forall j=1,2,\cdots,N_{t}.\end{split}  \tag{26}\]  
It can be observed that the first and third constraints are a series of linear inequations, while the second equation constraints are also linear. Therefore, the optimization Problem (26) is convex at each iteration. This convex problem can be solved by optimization algorithms such as the interior point algorithm. In this paper, we adopt a toolbox for MATLAB called CVX to solve this convex optimization problem [29]. Our proposed iterative precoding design method is concluded in Algorithm 1. ```
1. Set the initial \(\mathbf{MMSE}=+\infty\). 2. For loop from \(1\)-\(n_{loop}\)
3. Create the initial \(\mathbf{d}_{0}\) randomly satisfying Constraints (10), (15) and (22). Initialize \(\mathbf{F}_{0}\) with satisfying Constraints (15). Set the iteration number \(n=1\). 4. While \(n<n_{ite}\) (1) Calculate \(\mathbf{W}_{n}\) based on Equation (24) using \(\mathbf{F}_{n-1}\). (2) Solve the main optimization Problem (26) with fixed \(\mathbf{W}_{n}\) to gain \(\mathbf{F}_{n}\) and \(\mathbf{d}_{n}\). (3) \(n=n+1\). End
5. If \(\mathbf{MSE}_{n}<\mathbf{MMSE}\)  Let \(\mathbf{MMSE}=\mathbf{MSE}_{n},\mathbf{F}^{*}=\mathbf{F}_{n},\mathbf{W}^{*}= \mathbf{W}_{n},\,\mathbf{d}^{*}=\mathbf{d}_{n}\). End
6. \(loop=loop+1\). 7.