# Trying to create an Extended Kalman Filter for this problem at hand

Currently I have a system that measures the GPS coordinates of an object. The object is first detected and then using trigonometry, the GPS coordinates are determined, as we know of the GPS coordinates of the camera itself.

However, the camera is on a moving object and therefore the data for the GPS coordinates can be quite noisy. In order to tackle this, I have decided to use an EKF in accordance with the system at hand.

In order to integrate this system into the program that I am currently using, I have decided to use this library here: https://github.com/simondlevy/TinyEKF. However, here it says that

TinyEKF requires you to write only a single model function, filling in the values of the state-transition function f(x), its Jacobian matrix F(x), the sensor function h(x), and its Jacobian H(x). The prediction and update then handled automatically by passing the observation vector z to the step function.

The output of my GPS code, is always [lat, lon]. What is x and what is z here? I don't understand how to create a state transition matrix. however, I am aware that a jacobian can be calculated from the state transition matrix, if I know what it is. Also, what is the sensor function(x)?

• I hesitate to do someone else’s system engineering but you can, with a small correction term for the high latitudes convert WGS84 coordinates (what GPS uses) to local northings-eastings coordinates for your x and y. – Stanley Pawlukiewicz Mar 19 at 17:12
• I am not a systems engineer, and a computer scientist in fact. However, I am not inimical to the idea of reading a couple of resources that point me towards performing this system engineering. From the resources I have read, they are either too arduous or not relevant. – Sharan Duggirala Mar 19 at 21:29
• So how did you decide to use an EKF without doing an analysis? a much simpler alpha beta filter might have sufficed? what kind of position accuracy do you need? is the GPS the sensor or is there also a accelerometer producing measurements? I don’t know of anything in Computer Science that precludes establishing requirements. I don’t want to be negative but you really should think a bit more about your problem. – Stanley Pawlukiewicz Mar 19 at 22:13
• I understand the basics of an EKF's functionality where it filters out any erroneous/anomaly behavior. I have a single reading as specified in the question, and therefore do not require sensor fusion for now. Now asking me about what kind of position accuracy I need is a great question, since I have not yet correlated position accuracy to the use of the EKF. However, I wanted to dive in first and find out about the position accuracy I am attaining from my first attempt. – Sharan Duggirala Mar 19 at 22:34
• In kinematic systems, position, velocity, and acceleration are typical state variables. The state transition matrix follows from the differential equations for motion. there are several variations, not a single correct choice – Stanley Pawlukiewicz Mar 19 at 22:42