# Extended Kalman Filter : Measurement Matrix

1. Mar 21, 2012

### 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 [Broken]

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

Last edited by a moderator: May 5, 2017
2. Mar 21, 2012

### Stephen Tashi

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?

3. Mar 21, 2012

### mikedamike

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 [Broken]

Last edited by a moderator: May 5, 2017
4. Mar 21, 2012

### camillio

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.

5. Mar 22, 2012

### mikedamike

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?

6. Mar 22, 2012

### camillio

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 :-)

7. Mar 22, 2012

### mikedamike

Im still really struggling on my original question. I realise 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: Mar 22, 2012
8. Mar 22, 2012

### mikedamike

Sorry about this camillio. I understand that h(x) gets linearized to operate kalman functions on but i guess what im 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

9. Mar 23, 2012

### camillio

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.

10. Mar 23, 2012

### camillio

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$.

11. Mar 23, 2012

### mikedamike

This is it, im 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 dont know what this means i thought it implied that the measurements where identical to the state vector.

Last edited: Mar 23, 2012
12. Mar 23, 2012

### camillio

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.

13. Mar 23, 2012

### mikedamike

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.

14. Mar 24, 2012

### camillio

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.

15. Mar 27, 2012

### Stephen Tashi

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 knowlege 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.

16. Apr 3, 2012

### mikedamike

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

17. Apr 3, 2012

### Stephen Tashi

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 dont 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.

18. Apr 3, 2012

### mikedamike

Hi Im sorry about re-using this out dated post. I realise you dont 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

19. Apr 3, 2012

### Stephen Tashi

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

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

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?

20. Apr 3, 2012

### mikedamike

Last edited: Apr 3, 2012