This function analyzes the input data and calculates a common threshold for wavelet denoising for all detail levels using the specified methods. Four methods are available:
1. Fixed form: The threshold is calculated as sqrt(2*log(size(u,1))).
2. SURE: The threshold is calculated based on Stein's Unbiased Risk Estimate (SURE) of risk, which is a quadratic loss function.
3. Heuristic SURE: This is a heuristic version of the SURE method. It is actually a combination of the first two methods. For the signal with strong noises, the fixed form method is used. Otherwise, SURE method id used.
4. Minimal maximum: The threshold is estimated to realize the minimum of the maximum mean square error of the observed data. This method is derived from statistic theory.
It has to be noted that the thresholds calculated by thSelect in this toolbox are valid only if the noise has normal (Gaussian) distribution with zero mean and standard deviation of one! Otherwise, it is recommended that the data are to be pre-conditioned or the thresholds be manually selected.
function thSelect import Modelica.Math.*; input Real u[:] = {-1.3853, 1.5788, 2.2041, 3.9822, 3.3831, 6.7019, 5.1197, 5.9217, 4.2061, 3.5389, 3.4177, 2.1313, -0.7999, -2.4885, -3.2673, -4.6569, -4.0413, -5.1036, -5.3449, -6.2969, -3.7925, -3.4697, -3.0802, -0.8552, -1.5134, 1.0541, 2.2248, 3.3398, 3.1799, 4.8989, 4.4210, 4.0804, 3.4891, 5.1387, 2.3952, 1.9965, -0.2529, -0.6175, -4.8076, -3.8146, -5.1278, -5.4474, -5.0879, -5.3228, -2.8489, -4.8475, -3.7284, -4.0229, -1.7457, -1.3380} "Signal vector"; input Types.threshMethod thID = 1 "Threshold calculation method"; output Real th "Threshold value"; end thSelect;