# Extended Kalman Filter : Measurement Matrix

• mikedamike
In summary: It seems that you are trying to use the state vector x as an input to the EKF, but you do not have the function h(x). You need to read up on the EKF before you try to use it, and find a book that will explain it to you in more detail.
mikedamike
Hi,

I am currently learning and trying to build an extended kalman filter. However I am not sure how to created the measurement matrix. The measurement matrix H is described using formula 3.6 on page 18 of this document

http://www.scribd.com/doc/54702247/UAV-Design

My problem is that i do not understand how to operate that formula or what data i need to operate it. Is there anyone who could make sense of the equation and explain it to me.

Last edited by a moderator:
mikedamike said:
My problem is that i do not understand how to operate that formula

That link leads to a series of pages, so it isn't clear what formula you mean. Can you give a link to a version of that document as a PDF or something easier to read?

Sorry about that. I think this link will take you to the correct page. Its equation 3.7

http://www.scribd.com/doc/54702247/UAV-Design#page=21

Last edited by a moderator:
Dear mikedamike, it's quite similar to the ordinary KF. In the case of EKF, you don't have a simple explicit form of the matrix but there is a function. If you have possibility to read Simon's Optimal state estimation, kalman filters, H_inf filter and nonlinear approaches, there is a nice worked example.

Hi camillio,
Thanks for your reply. I have got the book you recommended and have only had a quick skim over it. Just to clarify am i right in assuming to calculate

h(xk)

i would simply use the linear function

Hxk

Where this implies that h(xk) in the EKF it is expressed as a nonlinear function but the EKF operates the function as a linear function?

Well, I'd better say that you linearize $h(x)$ around $x_k$ using the Taylor expansion, e.g. (Simon eq. 13.41) and then you operate on a linear function. I'm not sure that its exactly what you were meaning to say in your last post. However, I suggest to read that book or the related chapter, it will make you really master the topic :-)

Im still really struggling on my original question. I realize i need to make the measurement matrix using the state vector. Using the below equation basically implies that the matrix is essentially created by dividing x/x which i got from

Hk = $\frac{∂ h(x)}{∂ x}$

i think linerize Hk using taylor series.

Please correct me if my logic is incorrect.

The 5 element state vector for the system is x = [ q p r α β ]
The vector is updated using the sensors of an aircraft.

For purpose of example x = [ 2 4 3 5 9 ]

therefore my H matrix would be

$\frac{2}{2}$$\frac{2}{4}$$\frac{2}{3}$$\frac{2}{5}$$\frac{2}{9}$

$\frac{4}{2}$$\frac{4}{4}$$\frac{4}{3}$$\frac{4}{5}$$\frac{4}{9}$

$\frac{3}{2}$$\frac{3}{4}$$\frac{3}{3}$$\frac{3}{5}$$\frac{3}{9}$

$\frac{5}{2}$$\frac{5}{4}$$\frac{5}{3}$$\frac{5}{5}$$\frac{5}{9}$

$\frac{9}{2}$$\frac{9}{4}$$\frac{9}{3}$$\frac{9}{5}$$\frac{9}{9}$

Then i would just linearize the above using a taylor series.

Have i got this right or completely wrong?

Last edited:
Sorry about this camillio. I understand that h(x) gets linearized to operate kalman functions on but i guess what I am trying to ask is given a state vector x=[q p r a b] where the measurements are extracted from sensors how would the measurement matrix be constructed using the following formula Hk = ∂h(x)/∂x

Nevermind mikedamike. The steps are:
(i) differentiate the function $h$ wrt $x$. It is the same as computing Jacobian! You have $H_k$;
(ii) put values of $x_k$ into $H_k$;
(iii) run filter update.

I really propose to consult the book, in Ex. 13.3 you can see how measurement equation looks like, how linearized $H$ looks and notice the its dimension and $x_1$ element in it. That's where you put value of the estimated $x_1$.

Hope it helps.

Well, in addition to that post - I hope you know that you must have the function $h(x)$. It seems to me that you are playing just with "some" matrix (and call it $H$), but you don't have mentioned a particular form of $h$.

This is it, I am confused as i do not have the function of h(). The book defines the function for f() in the system dynamics matrix but not for h(). it does however describe a measurement vector y which is identical to the state vector. I don't know what this means i thought it implied that the measurements where identical to the state vector.

Last edited:
Hm, now I'm really lost. Can you send me which book and which page/problem? It is quite straightforward to express *regression* models as special forms of the Kalman filter and your last post resembles that, but I really doubt this is what your problem is about.

The book is called fault tolerant flight control and guidance systems by Guillaume J.J. Ducard. The pages of interest in the book 52-59 with the ekf vectors expressed on 49. I cannot upload the book because the file size is too big. If you would like me to get you an electronic copy i can do so.

Hm, I've read through the pages and haven't found any particular form of $h$. The same applies to $f$, but may be it's derived using "an expert's knowledge". Maybe previous pages, or so? In any case, I do not like the superficially theoretic but deeply (and incomprehensibly) applied treatment of EKF in this book :-(

I regret, mikedamike, can't provide better news.

I've only looked at the abstract definition of the measurement function. It seems to me that the function (obviously) depends on what your sensors measure. For example, suppose you have an accelerometer mounted on the right wingtip. What this accelerometer measures is probably not a state variable of the UAV. However, if you know the other state variables of the air craft (heading, acceration of roll angle etc.) you can write what this sensor ought measure in terms of those state variables. How to write this equation does involve expert knowledge of mechanics. To the deterministic equation for this variable, you add a term representing noise.

If my thoughts are correct, you shouldn't expect to find any "standard" set of measurement equations for a UAV, unless there is some "standard" set of sensors defined for UAVs.

Is it at all possiable that f(x) is equal to x=[q p r a b] ?

By this i am saying that any function required on the elements of X have already occurred (or possiably need not occur) and therefore the filter runs as f(x) is equal to x = [q p r a b]

Regards

mike

mikedamike said:
Is it at all possiable that f(x) is equal to x=[q p r a b] ?

It would be easier to make sense of this discussion if you defined the problem in a self contained way within a post. I don't have the book that's been mentioned and I find the Scribd user interface to be as irritating and useless as the Google books user interface.

I don't know what [q p r a b] denotes or what "f(x)" denotes. In my last post, I'm referring to the vector valued measurement function, which I think we are denoting by H(x) where x are the state variables. I'm saying that the jth component of H(x) would be what the jth sensor measures. Sensors may or may not directly measure the state variables. For example, the state variables of a UAV might include such things as the x,y and z components of the acceleration of the center of mass and the rate of change of the roll, pitch and yaw. They might not include the z acceleration component of the right wingtip. The state variables x are supposed to give us a complete description of the condition of the UAV. We can calculate the z acceleration of the right wingtip from the state variables. The function that does this calculation would be the component of H(x) corresponding to that sensor.

In a real world situation for a UAV, it is unlikely that you would have a sensor that directly measured each state variable, so it is unlikely that H(x) would be equal to the vector of state variables.

Hi I am sorry about re-using this out dated post. I realize you don't have the book. In that book it does define a systems dynamics matrix (Fk) and a control matrix (Gk) with equations and expresses that it should be evaluated with X (this to me means solve).

it defines the plant as

X' = f(x,u) <- this is the non linear plant

It then states that equation X' = f(x,u) is linearized using Euler integration equation

Xk+1 = Fk xk + Gk uk + wk

Therefore could i be correct in saying that f(x) is achieved by evaluating the system dynamics matrix with the state vector

Sorry to be a pain

mikedamike said:
it defines the plant as

X' = f(x,u) <- this is the non linear plant

Is x the vector of state variables and is u the vector of noise variables?

It then states that equation X' = f(x,u) is linearized using Euler integration equation

Xk+1 = Fk xk + Gk uk + wk

I suppose this means that we implement Euler's method for approximation the solutions to a differential equation. http://en.wikipedia.org/wiki/Euler_method
Therefore could i be correct in saying that f(x) is achieved by evaluating the system dynamics matrix with the state vector

It's hard to quarrel with verbal generalities!

If X' is "the system dynamics matrix" and this consists of the partial derivatives of the state variables with respect to the other state variables then applying Euler's method of approximating a differential equation would involve steps of evaluating the matrix X' at the values of state variables x and the noise variables u at time t and using the resulting value of the matrix X' to estimate the value of the state variables x at a later time t+h.

Was that the question?

Last edited:
My display just hangs at "loading..." when I scroll up. It isn't worth the trouble.

If this is an academic project, you're going to have do some sort of write-up eventually, aren't you? How do you intend to write the equations? Get started writing the problem up. The effort won't be wasted.

honestly i really need to learn the concept I am getting there its just a few things i need clarification on

My preview of the book in Google Books doesn't include a page 52. (And don't refer to the page by the page number that's marked on the page itself, refer to it by the page that's shown at the top of the Google Books' screen.)

it will start on pg 234 scroll up 2 pages and it jumps to page 61. page 52 is my interest where 52 of book page = 52 of page number in google books.

regards
mike

My view of the book doesn't behave as you described. I don't get page 52 as part of my preview. Perhaps each person who views a book that is incompletely presented gets to see a randomly selected part of the book that is a function of his IP address or something like that.

## 1. What is the purpose of the measurement matrix in an Extended Kalman Filter?

The measurement matrix in an Extended Kalman Filter is used to map the predicted state of a system to the measured state. It helps to incorporate sensor measurements into the filtering process and improve the accuracy of the estimated state.

## 2. How is the measurement matrix different from the state transition matrix in an Extended Kalman Filter?

The state transition matrix describes how the state of a system evolves over time, while the measurement matrix describes how the predicted state is related to the measured state. The state transition matrix is based on the underlying physics of the system, while the measurement matrix is based on the sensor measurements.

## 3. Can the measurement matrix be time-varying in an Extended Kalman Filter?

Yes, the measurement matrix can be time-varying in an Extended Kalman Filter. This is often the case when dealing with nonlinear systems, where the relationship between the predicted state and the measured state may change over time.

## 4. What is the difference between the measurement matrix and the observation matrix in an Extended Kalman Filter?

The measurement matrix is used in the prediction step of the Extended Kalman Filter to map the predicted state to the measured state. The observation matrix, on the other hand, is used in the update step to map the state prediction error to the measurement residual. In linear systems, the measurement matrix and observation matrix are often the same, but in nonlinear systems, they are different.

## 5. How is the measurement matrix chosen in an Extended Kalman Filter?

The measurement matrix is chosen based on the type of sensors used to measure the system state. It should be designed to capture the relationship between the predicted state and the measured state accurately. This can be done through system identification techniques or using prior knowledge of the system's dynamics.

Replies
6
Views
3K
Replies
4
Views
2K
Replies
1
Views
890
Replies
1
Views
966
Replies
2
Views
2K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
3
Views
3K
Replies
1
Views
1K
Replies
24
Views
10K