# Wi-Senser: Contactless Head Movement Detection during Sleep Utilizing WiFi Signals
## 2 Preliminaries  
This section presents a theoretical model for utilizing WiFi signals to perceive changes in human body movement [23]. Specifically, at time \(t\), if the WiFi signal reaches the receiver through N paths, the complex value of channel frequency response CFR of the \(i^{th}\) subcarrier in the WiFi channel can be represented as:  
\[H(f_{i},t)=e^{-\jmath 2\pi\Delta ft}\Bigg{(}H_{s}(f_{i})+\sum_{k\in\mathbb{P}_{ d}}a_{k}(f_{i},t)e^{-\jmath 2\pi\frac{d_{k}(t)}{\lambda_{i}}}\Bigg{)} \tag{1}\]  
where \(f\) is the carrier frequency, \(\Delta f\) is the carrier frequency offset between the transmitter and receiver, \(\lambda\) is the wavelength, and \(P_{d}\) is the dynamic path set. \(H_{s}(f_{i})\) is the cumulative CFR of static paths, which has relatively stable energy attenuation and propagation delay due to near-constant propagation length. Therefore, \(H_{s}(f_{i})\) is usually regarded as a constant. \(a_{k}(f_{i},t)\) represents the energy attenuation of the \(k^{th}\) dynamic path, and \(-2\pi\frac{d_{k}(t)}{\lambda_{i}}\) represents the phase shift caused by the transmission delay along the \(k^{th}\) dynamic path (with a length of \(d_{k}(t)\)). \(-2\pi\Delta ft\) represents the phase shift caused by the carrier frequency offset \(\Delta f\). According to Equation (1), the CSI energy (\(\left|H(f_{i},t)\right|^{2}\)) can be derived as:  
\[\left|H(f_{i},t)\right|^{2}=\left|e^{-\jmath 2\pi\Delta ft}\right|^{2} \left[e^{-\jmath 2\pi\Delta ft}\Bigg{(}H_{s}(f_{i})+\sum_{k\in\mathbb{P}_{ d}}a_{k}(f_{i},t)e^{-\jmath 2\pi\frac{d_{k}(t)}{\lambda_{i}}}\Bigg{)}\right]^{2} \tag{2}\]Since \(e^{-j2\pi\Delta ft}\) represents a unit vector rotating an angle of \(-2\pi\Delta ft\) in the complex plane, its influence on CSI energy (\(|H(f_{i},t)|^{2}\)) can be ignored. That is, under the condition of ignoring the effect of carrier frequency offset, Equation (1) can be rewritten as:  
\[H(f_{i},t)=|H_{\rm s}(f_{i})|e^{i\phi_{\rm s}}+\sum\limits_{k\in P_{d}}|a_{k}(f_ {i},t)|e^{i(\phi_{k}-2\pi\frac{d_{k}(t)}{\lambda_{i}})} \tag{3}\]  
where \(\phi_{\rm s}\) is the rotation angle of the synthesized vector of static paths, and \(\phi_{k}\) is the initial phase of the \(k^{th}\) dynamic path. Based on [PERSON]'s formula (\(\cos\theta+j\)sin \(\theta=e^{i\theta}\)), Equation (3) can be further expanded as:  
\[ \begin{array}{ll}H(f_{i},t)=&|H_{\rm s}(f_{i})|\cos\phi_{\rm s}+\sum\limits _{k\in P_{d}}|a_{k}(f_{i},t)|\cos\Bigl{(}\phi_{k}-2\pi\frac{d_{k}(t)}{\lambda_ {i}}\Bigr{)}\\ &+j\Biggl{[}|H_{\rm s}(f_{i})|\sin\phi_{\rm s}+\sum\limits_{k\in P_{d}}|a_{k}( f_{i},t)|\sin\Bigl{(}\phi_{k}-2\pi\frac{d_{k}(t)}{\lambda_{i}}\Bigr{)}\Biggr{]} \end{array}  \tag{4}\]  
Therefore, the sum of the squares of the real and imaginary parts in Equation (4) is the CSI energy:  
\[ \begin{array}{ll}|H(f_{i},t)|^{2}&=\Biggl{[}|H_{\rm s}(f_{i})|\cos\phi_{\rm s }+\sum\limits_{k\in P_{d}}|a_{k}(f_{i},t)|\cos\Bigl{(}\phi_{k}-2\pi\frac{d_{k }(t)}{\lambda_{i}}\Bigr{)}\Biggr{]}^{2}\\ &+\Biggl{[}|H_{\rm s}(f_{i})|\sin\phi_{\rm s}+\sum\limits_{k\in P_{d}}|a_{k}( f_{i},t)|\sin\Bigl{(}\phi_{k}-2\pi\frac{d_{k}(t)}{\lambda_{i}}\Bigr{)}\Biggr{]}^{2} \end{array}  \tag{5}\]  
Equation (5) can be expanded, organized, and simplified based on trigonometric properties as:  
\[ \begin{array}{ll}|H(f_{i},t)|^{2}=|H_{\rm s}(f_{i})|^{2}+\sum\limits_{k\in P _{d}}|a_{k}(f_{i},t)|^{2}+\sum\limits_{k\in P_{d}}2|H_{\rm s}(f_{i})||a_{k}(f_ {i},t)|\cos\Bigl{(}2\pi\frac{d_{k}(t)}{\lambda_{i}}+\phi_{\rm s}-\phi_{k} \Bigr{)}\\ \hskip 142.26378 pt+\sum\limits_{\begin{subarray}{c}k\in P_{d}\\ k\
eq l\end{subarray}}2|a_{k}(f_{i},t)||a_{l}(f_{i},t)|\cos\Bigl{(}2\pi\frac{d_ {l}(t)-d_{k}(t)}{\lambda_{i}}+\phi_{k}-\phi_{l}\Bigr{)}\end{array}  \tag{6}\]  
According to the literature [23], by assuming that the \(k^{th}\) dynamic path has a relatively stable velocity change due to human movement in a short time, i.e., \(d_{k}(t)=d_{k}(0)+v_{k}t\), substituting it into Equation (6), we can obtain:  
\[