Extended Kalman Filter converges to wrong values (super simple model)

11 views (last 30 days)
I am trying to implement an Extended Kalman Filter for an hydraulic/electric circuit that has a resistance (R) and a Capacitor (C) both are connected in parallel. Pressure and flow (voltage and current) are measured. Aim is to estimate R and C. The estimation of the EKF for C is with in the expected range, but the R is always of by a constant factor.
the ODE is: dp/dt = -p/CR + q/C (p is pressure (or voltage), q is flow (or current))
in discrete time the pressure for the next time step is: p = p + T(q/C-p/CR)
I tried two implementations that differ in the state selection:
1. x = [p, 1/C, 1/(C*R)] <-- off by factor 2
2. x = [p, 1/C, 1/R] <-- off by factor 3
for both the input is q and the output is p.
I double checked the equations, and played with different implementations for some days now, but R is always off. and i dont understand why. So it would be great to get some advice because i am running out of ideas.
The jacobians are:
1. state: [1 - Tx3, T u, -T x1 0, 1, 0 0, 0, 1]
2. state [1 - T*x3*x2, T(u-x1x3), -T x1x2 0, 1, 0 0, 0, 1]
It is implemented in simulink and the model is attached if anybody wants to have a look. (packed as zip because slx is not supported)

Accepted Answer

John Petersen
John Petersen on 2 Jan 2015
You have a constant dt used in the filter, but the simulation is variable step. This will cause problems with your predictor. Fix this and then see how it goes.
  1 Comment
Frank on 7 Jan 2015
Thanks for your response, I finally found the issue(s).
One was in fact timing related. The sample time of the EKF has to be fixed and not inherited.
The second one was that for the prediction step i used the linearized matrix F to calculate the states. BUT, since known, you can (and have to) use the nonlinear function f.
now it woks nicely! :)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!