Can the transition function for Kalman Filter be a random normal distributed variable?

89 Views Asked by At

One simple question about Kalman Filters. It's told that you need a model of the system to estimate the next measurement, e.g state. The model is called a transition function.

$$\dot x = f(x, u)$$

What if I don't know my transition function, but I know that the states are normal distributed. Can I say that my transition function is a gaussian distributed random variable $X$ with mean $\mu$ and deviation $\sigma$?

Edit:

I have tried a random variable who is normally distributed with the mean $\bar X$ and deviation $\sigma$

$$X = N(0, 1)*\sigma + \bar X$$

I tried this with Unscented Kalman Filter and the result looked like this. enter image description here

I made MATLAB code to do the plot. https://github.com/DanielMartensson/STM32-Libraries/tree/master/VL6180X

function x = ukf_transition(s, L)
  N = 2 * L + 1;
  x = zeros(L, 1);
  for i = 1:N
    x(i) = std(s(:, i))*randn + mean(s(:, i)); % std*random_variable + average = Gaussian distribution
  end
end

There are also C-code available here. https://github.com/DanielMartensson/CControl/blob/master/src/CControl/Documents/Examples/Filtering/ukf.txt

1

There are 1 best solutions below

11
On BEST ANSWER

Even though you have solved your problem, I want provide some clarification to your question.

The Kalman Filter (KF) requires the process model and the measurement model be defined. The process model defines how the state evolves (i.e., the next state given the current state and control input), and the measurement model defines how the measurements are generated (i.e., the measurement given the current state).

The process model is defined as follows: $$ x_{t+1} = F_t x_t + B_t u_t + w_t$$ where $x_t$, $u_t$, and $w_t$ are the state, control input, and process noise with $w_t \sim \mathcal{N}(0, \mathbf{Q}_t)$ where $\mathbf{Q}_t$ is the covariance matrix of the process noise.

Can I say that my transition function is a gaussian distributed random variable X with mean μ and deviation σ?

This is somewhat unclear, but I see 2 possible interpretation, and in both interpretation, you can use the process model you describe.

Interpretation 1: You mean that your state is simply a random variable (i.e., not a function of the previous states), so the process model would be the following:

$$x_{t+1} = \mu + w_t$$ where $\mu$ is a constant and $w_t \sim \mathcal{N}(0,\sigma)$ is the process noise. This is kind of odd, and a KF will not benefit you because the optimal state estimate is simply $\mu$, so a KF is unnecessary.

Interpretation 2: You are trying to model random walk. In other words, your state moves randomly at each time step. In this case, you process model would be the following:

$$x_{t+1} = x_t + \mu + w_t$$ where $w_t \sim \mathcal{N}(0,\sigma)$ is the process noise. This makes the most sense to me given your description of the problem, but is unclear in your question.

Note:

It's told that you need a model of the system to estimate the next measurement, e.g state.

You do need a model of the system to estimate the next measurement, but in general, the measurements are not the same as the states. The measurement is a function of the states, and the measurement model is used to predict the measurement given the state.

Edit:

I saw your edit. This model does not make sense. I encourage you to try to write the process and observation models for your system, then the application of an extended Kalman filter (EKF) or unscented Kalman filter (UKF) is straight forward. The EKF and UKF provide estimates of the distribution of the states (i.e., unknown parameters), which are hidden.

Based on the description of your transition, the state is random at each time step, but the distribution of this randomness is known; thus, the EKF or UKF are useless in this scenario. The best guess of your state (i.e., optimal state estimate) is simply the mean of the known distribution.

However, I am guessing (e.g., what you intend is) your dynamics are static (i.e., the state is constant), and your observation model is the identity. Therefore, the process model is simply $$x_{t+1} = x_t,$$ and, the observation model is simply $$ y_t = x_t + v_t$$ where $v_t \sim \mathcal{N}(0,\sigma)$.

If my guess is correct, you should use the functions in your implementation of the EKF or UKF, and the function you provided for propagating the particles through the transition model is incorrect.