7

I'm a software engineer with a CS degree working in machine learning. I'm trying to learn about Kalman Filters.

In this short YouTube video from Mathworks, there's a discussion on a Kalman Filter with regard to a rocket:

  • We want to measure a rocket engine's internal temperature $T_{in}$.
  • We can't put a temperature sensor directly inside the exhaust port because it's too hot.
  • Instead, we put an external temperature sensor outside the engine exhaust to measure $T_{ext}$.
  • We know how much fuel we're using: $W_{fuel}$.

Kalman Filter and rockets

The video says that we want to reduce the error between the measured external temperature $T_{ext}$ and an estimate of the external temperature $\hat{T}_{ext}$. In turn, that will reduce the error between the unobserved temperature $T_{in}$ and its estimate $\hat{T}_{in}$.

I work in machine learning, so I'm confused by what are the inputs and outputs of this system. My specific questions are:

  1. $T_{ext}$ is an input to the system using an external sensor. Why is it shown as an output of this system?

  2. We are trying to predict $\hat{T}_{in}$. Presumably it is a function of $W_{fuel}$ and $T_{ext}$; that is, $\hat{T}_{in} = f(W_{fuel}, T_{ext})$. Why is this system even trying to predict the external temperature $\hat{T}_{ext}$ if the true external temperature $T_{ext}$ is measured?

  3. If I were to solve this problem using machine learning, I'd implement a regression model to predict exactly $\hat{T}_{in} = f(W_{fuel}, T_{ext})$ with $W_{fuel}$ and $T_{ext}$ as input features to linear regression or a neural network model. Why do we need to set up this Kalman Filter system at all?

Thanks for any help.

Royi
  • 19,608
  • 4
  • 197
  • 238
stackoverflowuser2010
  • 847
  • 1
  • 11
  • 14
  • Notice the bracket on Text. Measured external temperature vs estimated external temperature. The first one is an input, the second one an output. Based on your model, process noise and measurement noise estimates, the Kalman filter will try to estimate optimally (in a Gaussian sense) the external and internal temperatures. – Ben Aug 12 '21 at 04:27
  • If your model is reasonably close to your system and if your process and measurement covariances are well chosen, then Text measured and Text estimated should comverge – Ben Aug 12 '21 at 04:28
  • @Ben: Why do we even need to estimate $\hat{T}{ext}$? Why do we care about it? We want to estimate $\hat{T}{in}$, right? – stackoverflowuser2010 Aug 12 '21 at 04:37
  • Your measurement is absolutely noise-free? If not, then estimating it will improve the measurement. Remember, you also have your fuel intake as a measurement. – Ben Aug 12 '21 at 12:41
  • Shouldn't the arrow for $T_{ext}$ in that picture be pointing into the box rather than out of the box? – stackoverflowuser2010 Aug 12 '21 at 17:12
  • @Ben : Is the only point of Kalman Filters that the sensors are noisy? If the sensors were not noisy, then we could just apply a machine learning model to compute $T_{in} = f_{ML}(W_{fuel}, T_{ext})$, right? – stackoverflowuser2010 Aug 12 '21 at 17:16
  • Not exactly, there is also process uncertainty, your model is not the same as reality. – Ben Aug 12 '21 at 19:34
  • No Text is only an output of the Kalman filter since you don't measure it. – Ben Aug 12 '21 at 19:35
  • @Ben: No Text is only an output of the Kalman filter since you don't measure it. Are you referring to $\hat{T}{ext}$ ? I know that variable is predicted. But $T{ext}$ (without the hat ^) is directly measured in this example. – stackoverflowuser2010 Aug 12 '21 at 20:56
  • I meant Tin, sorry. – Ben Aug 12 '21 at 21:37
  • You should read this book to learn more and systems and control, perhaps the purpose of the Kalman Filter will be clearer. – Ben Aug 12 '21 at 21:38

1 Answers1

3

The Kalman Filter is basically a framework to fuse 2 things:

  1. Measurement.
  2. Dynamic Model (Dynamic in the sense we can predict next value from a current value).

In your case the model is composed of two things:

  1. Model which connects $ {T}_{ext} $ and $ {W}_{fuel} $ to $ {T}_{in} $.
  2. Measurement of $ {T}_{ext} $.

Now, the reason you estimate $ {T}_{ext} $ is because no sensor is perfect. The model of a sensor is $ {T}_{ext} \left[ k \right] = {T}_{ext - gt} \left[ k \right] + v \left[ k \right] $. Namely we get a measurement with added noise.

What's missing in the model of the video is the actual model. I have no experience in the field of heat transfer but let's assume the model is something like:

$$ {T}_{in} \left[ k \right] = {T}_{in} \left[ k - 1 \right] + \alpha {w} \left[ k - 1 \right] $$

And:

$$ {T}_{ext} \left[ k \right] = \beta {T}_{in} \left[ k \right] $$

Then you can build the model for the Kalman Filter and it will fuse the knowledge about $ {T}_{in} $ from the model which relates to $ {T}_{out} $ and the model which given the $ {T}_{in} $ of the previous iteration how it should be in the next.

Regarding your experience with Machine Learning.
Kalman Filter assumes a Bayesian Model. Hence it is not a parameterized.
You could estimate $ {T}_{in} $ from measurements of $ {T}_{ext} $ and $ W $ but then you'll miss the prior you're given: The dynamic model.

Royi
  • 19,608
  • 4
  • 197
  • 238
  • Thank you for the answer. Am I correct in generalizing that in problems that need a Kalman Filter: (1) We are looking to predict some hidden state (in this case $T_{in}$); (2) We also need to predict the measurement of every noisy sensor that we use; and (3) More accurately performing (2) will help us more accurately perform (1) ? – stackoverflowuser2010 Aug 14 '21 at 15:46
  • There are 2 models: The dynamic model and the measurement model. They define the same state vector. Kalman Filter fuse them for the optimal estimation of the state vector. – Royi Aug 14 '21 at 16:05
  • Thank you. Can you please let me know if my three points (1), (2), (3) are correct, incorrect, or even irrelevant? – stackoverflowuser2010 Aug 14 '21 at 18:22
  • They are correct. Just pay attention we don't do (2) explicitly. We just go for (3) which is written in a form which fuse the measurement and the model optimally. – Royi Aug 14 '21 at 18:25