I'm trying to implement the UKF for parameter estimation as described by Eric A. Wan and Rudolph van der Merwe in Chapter 7 of the Kalman Filtering and Neural Networks book: Free PDF
I am confused by the setting of $\lambda$ (used in the selection of sigma points and in the calculation of the weights for the mean). The authors recommend setting:
$\lambda = \alpha^2(L+k) - L$ where L is the dimension of the x. With alpha "small" $0 < \alpha < 1$, k either 0 or 3-L (different sources disagree on this). Sigma points are then calculated as a matrix $\chi$ with:
$\chi_{0} = x$
$\chi_{i} = x + \sqrt{ ((L+\lambda)*P_{x})_{i} }$ for i = 1....L
$\chi_{i} = x - \sqrt{ ((L+\lambda)*P_{x})_{i} }$ for i = L+1....2L
Where $(\sqrt{ (L+\lambda)*P_{x} })_{i}$ is the ith column of the square root of the covariance matrix of x.
Sigma points are ran through f:
$ Y_{i} = f(\chi_{i})$ i=0...2L
and the mean of Y is calculated as:
$ \bar{Y} = \sum{w_{i}Y_{i}}$
With the weights $w_{i}$ given as:
$$ w_{0} = \dfrac{\lambda}{L + \lambda} $$ $$ w_{i} = \dfrac{1}{2(L + \lambda)} $$
The issue I am running into is that for any reasonable values of L,$\alpha$ and k, $W_{0}$ ends up being negative (often very large negative values). While $W_{i}$ does sum to 1, the negative value results in the calculated mean being extremely far off. I'm sure there is something I am missing, but I can't figure out what.