Hello who interested with my question,
Firstly, I want to thanks you for spending your time to read this topic!
So I have 3 questions that need some advice in Unscented Kalman Filter about the 3 DoFs Mass-Damping-Stiffness System. Right now, i'm modifying my UKF code in MATLAB for a new project but some problems seem to occur again. Below there are 2 Code files - one was the UKF test and one was an UKF function that I've writen in my graduated thesis and here are the problems I incurred:
1/ The Cholesky Decomposition: I used the chol() function from library of MATLAB. However in my test, from the loop k=3, the covariance matrix was starting to fail in excuting chol() because it was not completely positive definited!
My solution: First, I used a function name "nearestSPD" of Mr. John D'Errico and this function have helped my covariance matrix pass the chol() but the output (state vector) I received was full of 0 from the loop k=3. Second approach was plusing (1e-6)*eye() into the covariance matrix but MATLAB code stopped from the loop 3 and said that matrix wasn't positive definited!
2/ Kalman Gain: since the equation of Kalman Gain has the inverse matrix, some value of Kalman Gain of my code in some loop can't be calculate because the covariance matrix is singularity and it doesn't have the inverse version!
My solution: in MATLAB, I've used pinv() (Moore-Penrose Inverse matrix) instead of the regular inverse inv()
3/ Choosing the workable Initial Covariance Matrix (P): How can we choose the suitable Initial Covariance Matrix for UKF?
My solution: Usually, I always choose the values of P corresponding to the error between the initial state vector and true parameter. For example, true k1 = 10000 N/m and in my initial state, I choose k1 = 8000 N/m -> value error of k1 in P will be chosen equal to 1e6.
If you have any suggestions, please feel free to repsonse! I would love to hear your idea!
My code is free and as long as you seem interested, you can use it freely! However, my code seems to fail due to 3 reasons above!
Thanks you!