# AI-Enabled Compact and Efficient Dynamic Light Scattering System for Precise Microparticle Sizing
## 2 Materials and Methods
### Feature Extraction  
The collected raw signal was denoised using a Kalman filter to suppress noise and enhance signal quality. Subsequently, the autocorrelation function of the denoised signal was computed, enabling the extraction of key characteristics associated with microsphere scattering.  
The basis for describing Kalman filtering is the discrete time linear dynamic system model, which consists of state equations and observation equations [25]:  
\[x_{k}=A_{k}x_{k-1}+B_{k}\mu_{k-1}+w_{k-1}, \tag{1}\]  
where \(x_{k}\in R^{n}\) is the state vector at time step \(k\), \(A_{k}\in R^{n\times m}\) is the state transition matrix, which describes the evolution of the state from \(k-1\) to \(k\). \(B_{k}\in R^{n\times m}\) is the control inputmatrix, and \(\mu_{k-1}\) is the control vector (which can be ignored when there is no control input). \(w_{k-1}\sim N(0,Q_{k})\) represents process noise, assumed to follow a zero-mean Gaussian distribution with covariance \(Q_{k}\).  
\[Z_{k}=H_{k}x_{k}+V_{k}, \tag{2}\]  
where \(z_{k}\in R^{p}\) is the observation vector at time step \(k\), \(H_{k}\in R^{p\times n}\) is the observation matrix, which maps the state vector to the observation space. \(v_{k-1}\sim N(0,R_{k})\) represents observation noise, assumed to follow a zero-mean Gaussian distribution with covariance \(R_{k}\).  
The Kalman filter operates in two recursive steps: prediction and update. The prediction step propagates the current state estimate forward in time:  
\[\hat{x}_{\overline{k}}=A_{k}\hat{x}_{k-1}+B_{k}\mu_{k-1}, \tag{3}\]  
where \(\hat{x}_{\overline{k}}\) is the predicted state at time \(k\).  
\[P_{\overline{k}}=A_{k}P_{k-1}A_{k}^{\top}+Q_{k}, \tag{4}\]  
where \(P_{\overline{k}}\) is the predicted covariance matrix, representing the uncertainty in the predicted state.  
The update step incorporates the observation to refine the predicted state:  
\[K_{k}=P_{\overline{k}}H_{k}^{T}A_{k}^{T}\Big{(}H_{k}P_{\overline{k}}H_{k}^{T} +R_{k}\Big{)}^{-1}, \tag{5}\]  
where \(K_{k}\) is the Kalman gain matrix, which determines the balance between the predicted state and the measurement.  
\[\hat{x}_{k}=\hat{x}_{\overline{k}}+K_{k}\big{(}z_{k}-H_{k}\hat{x}_{\overline{ k}}\big{)}, \tag{6}\]  
where \((z_{k}-H_{k}\hat{x}_{\overline{k}})\), is the innovation, representing the difference between the observed and predicted values.  
\[P_{k}=(I-K_{k}H_{k})P_{\overline{k}}, \tag{7}\]  
where \(P_{k}\) is the updated covariance matrix, representing the uncertainty in the updated state.  
The autocorrelation function is mathematically defined as the expectation of the product of the signal and its lagged version:  
\[R_{xx}(\tau)=E[x(t)\times x(t+\tau)], \tag{8}\]  
where \(R_{xx}(\tau)\) is the autocorrelation function at lag \(\tau\), \(E[\;]\) denotes the expectation operator, \(x(t)\) is the signal or time series under analysis, and \(\tau\) is the time lag.  
The Frobenius norm is a measure often used for matrices, and it extends the concept of the Euclidean norm to matrices. It is named after the German mathematician [PERSON].  
Calculation for a matrix:  
\[\text{For a matrix }\mathbf{A}=\begin{bmatrix}a_{11}&a_{12}&\dots&a_{1n}\\ a_{21}&a_{22}&\dots&a_{2n}\\ \vdots&\vdots&\ddots&\vdots\\ a_{m1}&a_{m2}&\dots&a_{mn}\end{bmatrix},\]  
the Frobenius norm is given by The Kalman filter, implemented through the pykalman package, was employed for signal smoothing. For the Kalman filter configuration, measurement variance was set to 1.0, and process variance to 1 \(\times\) 10\({}^{-5}\). The filter was initialized with a mean of 0 and a covariance of 1 for the initial state, with identity matrices for both observation and transition matrices.