I am working on developing a particle filter to improve the results of an Unscented Kalman filter (UKF) to satellite attitude determination. The UKF outputs a 12-dimensional joint normal distribution (the proposal distribution), from which I randomly sample N points (particles) (currently N=100). Then the particle filter uses the observation data to assign weights to the particles (more likely to produce the observations => more weight to the particle), and then I calculate the new vector of weighted means and the weighted unbiased sample covariance matrix using the formula given here: https://en.wikipedia.org/wiki/Sample_mean_and_covariance#Weighted_samples
Then the vector of means and the covariance matrix are fed into the UKF (it treats them as if they came from a normal distribution) and it produces a new joint normal distribution output, and the cycle is repeated for each timestep.
The particle filter seems to be working very well and it's improving the results of the Kalman filter (the results are similar, but more smooth). However, thanks to the weights assigned during the particle filter step, the variances and covariances become very small, until they're approximated as 0 by the code and the whole thing crashes after a certain number of timesteps. (The variance/covariance becoming too small is also an inherent problem, as the filter can never be 100% exact.)
In a sense, this is to be expected, since the weights assigned by the particle filter often give more importance to the points closer to the mean (since ideally the mean is close to the observation data), which then contribute less to the variance/covariance. Is there a way to artificially keep the covariance matrix from becoming too small? Or is there something wrong with using the particle filter this way? Thoughts?