## 2 Methods
### Model for Eliminating Mixed Noise Based on Median Signal Filtering  
Using a median filter to eliminate mixed noise is more effective than a linear filter. Linear filtering procedures are optimal for a uniform or Gaussian interference distribution, which implies a simplification of the noise structure in real signals.  
Given the ranking of samples over time, median filters adequately suppress noise and interference, when the length is less than half the sliding window. A useful signal is a stable data sequence (in the case of a one-dimensional signal) or a data array (in the case of two-dimensional scanning) that does not change during median filtering.  
Median filtering is implemented as an algorithm for the local processing of time samples in a sliding window, which includes a certain number of signal samples. For each position of the sliding window, the samples that are allocated in it are ranked according to increasing or decreasing values. The median in the ranked list is a group of samples positioned at the middle of the list.  
It is assumed that the measured signal \(x(t)\), in addition to the useful signal \(s(t-\tau_{0})\) and fluctuation noise \(q(t)\), contains pulsed flows \(g(t)\) of different intensities with a regular or chaotic structure:  
\[x(t)=s(t-\tau_{0})+g(t)+q(t). \tag{15}\]  
where \(s(t-\tau_{0})\) is a useful signal that has an unknown temporary position \(\tau_{0}\in[0,\) T\(]\), \(q(t)\) is fluctuation noise with a regular or chaotic structure (Gaussian and Poisson noise), \(g(t)=\sum_{k}(t-\tau k)\) are pulsed flows of various intensities with a regular or chaotic structure, and \(\tau_{k}\) is the unknown temporal position of pulses.  
According to probability theory, the distribution function \(F(x)\) of the measured quantities \(x=\text{med}\ (x_{1},...,\ x_{n})\) for large \(n\) is approximately normal:  
\[F(x)=N(m_{t},\sigma_{n}), \tag{16}\]  
where \(m_{t}\) is a theoretical median determined from the condition \(F(m_{t})=0.5\), \(\sigma_{n}\) is the distribution variance, and \(n\) is the number of measurements of \(x\).  
In this case, the variance of the distribution of the median is determined as:  
\[{\sigma_{n}}^{2}=1/(n\ 4\!f^{2}(m_{t})), \tag{17}\]  
where \(f(x)\) is the probability density distribution of quantities \(x\).  
If the random variables x are independent and equally distributed with the normal distribution \(N(m,\,\sigma)\), then \(m_{t}=m\), then the median dispersion formula for small odd values of n takes the form:  
\[{\sigma_{\text{g}}}^{2}\approx\pi{\sigma^{2}}/(2n-2+\pi). \tag{18}\]  
If the function \(f(x)\) is symmetric with respect to \(m\), then the distribution of the medians will also be symmetric with respect to \(m_{t}\).  
Thus, the following formula is valid for determining the mathematical expectation:  
\[M[\text{med}(x_{1},\ldots,x_{n})]=M[x_{i}]=m. \tag{19}\]  
The criterion, in accordance with which the size of the sliding window with central count \(x_{r}\) is increased and the subsequent iteration is performed, takes the form:  
\[\max[S_{n}(x_{r})]<S_{\text{threshold}} \tag{20}\]  
where \(S_{n}(x_{r})\) is the deviation of the amplitude of adjacent samples of the signal \(x(t)\) that are located within the sliding window of size \(nt\), relative to the amplitude of the central sample \(x(r)\); \(S_{\text{threshold}}=[0,\) T\(]\) is the threshold coefficient of signal intensity.  
In Figure 3, an example of applying median filtering to a model signal \(a_{k}\) is shown. It is composed of a deterministic signal \(s_{k}\) and a random signal \(q_{k}\) having a normal distribution with single pulse surges \(\delta(t)\) of short duration.  
The results of calculating the median \(m_{t}\) for the signal \(x(t)\) are valid for both one-dimensional and two-dimensional filtering if the number of samples \(n\) is equal to the number of points in the aperture of the median filter.