## 3 Digital Beam Control and Beamforming Algorithm Design
The magnitude of the input signal for the \(n\)-th channel (n = 1\(\sim\)31) after ADC sampling can be expressed as:  
\[S_{n}=A_{n}\sin(2\pi f+\varphi_{n}) \tag{26}\]  
The magnitude of the reference signal can be expressed as:  
\[S_{Ref}=A_{Ref}\sin(2\pi f+\varphi_{Ref}) \tag{27}\]  
The above signals (24) and (25) are processed for down-conversion, resulting in the \(I\)-channel and \(Q\)-channel signals for the \(n\)-th input signal and the reference signal, respectively, as follows:  
The \(n\)-th input signal channel:  
\[ \begin{array}{ll}I\text{-channel:}&S_{n,I}=\cos[2\pi(f-f_{DDS})+(\varphi- \varphi_{DDS})]+\\ &\cos[2\pi(f+f_{DDS})+(\varphi+\varphi_{DDS})]\end{array}  \tag{28}\]  
\(Q\)-channel:  
\[ \begin{array}{ll}S_{n,Q}=\sin[2\pi(f-f_{DDS})+(\varphi-\varphi_{DDS})]+\\ &\sin[2\pi(f+f_{DDS})+(\varphi+\varphi_{DDS})]\end{array}  \tag{29}\]  
Reference signal channel:  
\[ \begin{array}{ll}I\text{-channel:}&S_{Ref,I}=\cos[2\pi(f-f_{DDS})+(\varphi_{ Ref}-\varphi_{DDS})]+\\ &\cos[2\pi(f+f_{DDS})+(\varphi_{Ref}+\varphi_{DDS})]\end{array}  \tag{30}\]  
\(Q\)-channel:  
\[ \begin{array}{ll}S_{Ref,Q}=\sin[2\pi(f-f_{DDS})+(\varphi_{Ref}-\varphi_{DDS}) ]+\\ &\sin[2\pi(f+f_{DDS})+(\varphi_{Ref}+\varphi_{DDS})]\end{array}  \tag{31}\]  
Subsequently, the above signals (26)-(29) are passed through a low-pass filter to remove high-frequency components, retaining the low-frequency signals, as shown below:  
The \(n\)-th input signal channel:  
\[ \begin{array}{ll}I\text{-channel:}&S_{n,I,LPF}=\cos[2\pi(f-f_{DDS})+(\varphi _{n}-\varphi_{DDS})]\end{array}  \tag{32}\]  
\(Q\)-channel:  
\[ \begin{array}{ll}S_{n,Q,LPF}=\sin[2\pi(f-f_{DDS})+(\varphi_{n}-\varphi_{DDS} )]\end{array}  \tag{33}\]  
Reference signal channel:  
\[ \begin{array}{ll}I\text{-channel:}&S_{Ref,J,LPF}=\cos[2\pi(f-f_{DDS})+( \varphi_{Ref}-\varphi_{DDS})]\end{array}  \tag{34}\]  
\(Q\)-channel:  
\[ \begin{array}{ll}S_{Ref,Q,LPF}=\sin[2\pi(f-f_{DDS})+(\varphi_{Ref}-\varphi_{ DDS})]\end{array}  \tag{35}\]  
Since the signals are down-converted to zero frequency, we have:  
\[ \begin{array}{ll}f=f_{DDS}\end{array}  \tag{36}\]  
Therefore, Equations (30)-(33) can be simplified to:The \(n\)-th input signal channel:  
\(I\)-channel:  
\[S^{\prime}_{n,I,LPF}=\cos(\varphi_{n}-\varphi_{DDS}) \tag{37}\]  
\(Q\)-channel:  
\[S^{\prime}_{n,Q,LPF}=\sin(\varphi_{n}-\varphi_{DDS}) \tag{38}\]  
Reference signal channel:  
\(I\)-channel:  
\[S^{\prime}_{Ref,I,LPF}=\cos(\varphi_{Ref}-\varphi_{DDS}) \tag{39}\]  
\(Q\)-channel:  
\[S^{\prime}_{Ref,Q,LPF}=\sin(\varphi_{Ref}-\varphi_{DDS}) \tag{40}\]  
To obtain the phase difference of the \(n\)-th channel, the input signal of that channel needs to be multiplied by the reference channel signal in a complex operation as follows:  
\[S=(S^{\prime}_{n,I,LPF}+j\cdot S^{\prime}_{n,Q,LPF})(S^{\prime}_{Ref,I,LPF}+j \cdot S^{\prime}_{Ref,Q,LPF}) \tag{41}\]  
The \(I\)-channel and \(Q\)-channel signals of the output channel are respectively:  
\[S_{I}=\cos[(\varphi_{1}-\varphi_{DDS})-(\varphi_{Ref}-\varphi_{DDS})]=\cos( \varphi_{1}-\varphi_{Ref}) \tag{42}\]  
\(Q\)-channel:  
\[S_{Q}=\sin[(\varphi_{1}-\varphi_{DDS})-(\varphi_{Ref}-\varphi_{DDS})]=\sin( \varphi_{1}-\varphi_{Ref}) \tag{43}\]  
Using the arctan2 function, the phase difference of the \(n\)-th channel signal can be calculated as follows:  
\[\varphi_{n}-\varphi_{Ref}=\arctan 2(S_{Q},S_{I}) \tag{44}\]  
The receiving terminal is equipped with 31 receiving channels. After each channel receives the raw data, it first undergoes ADC sampling, followed by down-conversion processing to shift each signal to zero frequency. The signal is then passed through a low-pass filter to remove high-frequency components while retaining the zero-frequency signal. Subsequently, complex multiplication is performed, where each signal is multiplied with a reference signal. The I and Q channels obtain two signals, respectively, containing phase difference information. Finally, integration and arctan2 operations are performed to determine the phase difference for each signal.