TECHNISCHE UNIVERSIT ¨ AT DRESDEN FAKULT ¨ AT ELEKTROTECHNIK UND INFORMATIONSTECHNIK INSTITUT F ¨ UR BIOMEDIZINISCHE TECHNIK Final Project Title: Processing of abdominal recordings by Kalman ﬁlters Submitted by: Marcos Cruz Santiago Born on: 04.06.1987 in Esplugues de Llobregat, Spain Supervisors: Dr.-Ing. Sebastian Zaunseder (IBMT) Responsible Professor: Prof.Dr.-Ing.habil. Hagen Malberg (IBMT) Submitted on: April 14 th , 2012
Submitted by: Marcos Cruz Santiago
Born on: 04.06.1987 in Esplugues de Llobregat, Spain
Supervisors: Dr.-Ing. Sebastian Zaunseder (IBMT) Responsible
Professor: Prof.Dr.-Ing.habil. Hagen Malberg (IBMT) Submitted on:
April 14th, 2012
Acknowledgement
I hereby declare that the present work submitted to the examination
board from the Fakultat Elektrotechnik und Informationstechnik with
the Final Project entitled
Processing of abdominal recordings by Kalman filters
that has been completely written by me, the undersigner, and that I
have not used any other document other than the specified means,
materials and references. All references and resources used by me
in this work are properly cited within it.
Dresden, April 14th, 2012
Abstract
Heart diseases are the cause of many deaths during prenatal,
childbirth and newborn periods. Therefore, the study of the fetal
cardiac signals might be very helpful in order to evaluate the
fetal heart status for early detection of cardiac
abnormalities.
The recent trend in obtaining the fetal electrocardiogram (fECG) is
to record signals in a non invasive way, by using surface
electrodes placed on the maternal abdomen. Extracting the fetal
component from this abdominal recordings is a challenging task due
to the low energy of the fECG, which often is buried into maternal
electrocardiography and noise sources.
Although an extraction method for this purpose was developed at
IBMT based on the Event Synchronous Canceller (ESC) method, the
obtained results were still not enough accurate. Thus, this present
study contemplates the implementation of a method that can improve
the last obtained results. The chosen implemented scheme within
this work is a Kalman filter (KF) based approach. Besides, a
theoretical base of KF’s algorithm, various examples of its usage
in the general area of the ECG processing are given. This work
establishes the possibility of new works related to this technique
in the IBMT department.
Moreover, this work continues the collaboration between IBMT and
the University Hospital of Leipzig and therefore the algorithm has
not only been tested with simulated data but also with real data
obtained in the Hospital of Leipzig.
Finally, the obtained achievements have been contrasted and
compared with the former de- veloped method within this department.
The KF based scheme has not only been capable of successfully
extracting the fECG from abdominal recordings, but also it has
shown to be more robust than the previous scheme.
Final Project - Marcos Cruz Santiago iii
Zusammenfassung
Unerkannte Herzleiden des Fotus sind Ursache zahlreicher todlicher
Komplikationen, welche vor, wahrend, und kurz nach der Geburt
auftreten. Aus diesem Grund kann das Studium fetaler Herzsignale
sehr hilfreich sein, um den kardialen Zustand zu bewerten und damit
Auffalligkeiten fruhzeitig zu erkennen.
Der aktuelle technische Stand ist das nichtinvasive Ableiten des
fetalen Elektrokardiogramms (fEKG) mittels auf den Unterleib der
Mutter aufgeklebten Oberflachenelektroden. Die Ex- traktion der
fetalen Komponente aus diesen Ableitungen ist eine große
Herausforderung. Die interessierenden Signale besitzen nur eine
geringe Energie, sie sind daher oft vom EKG der Mutter und von
allgemeinen Storungen verdeckt.
Ein am IBMT bereits entwickeltes Verfahren zur Extraktion, welches
auf der ”Event Syn- chronous Canceller (ESC)”-Methode basiert,
generierte verbesserungsfahige Ergebnisse. Aus diesem Grund
betrachtet diese Arbeit die Umsetzung einer Methode, welche die
zuletzt erzeugten Resultate verfeinern kann. Der in dieser Arbeit
genutzte Entwurf ist eine Kalman-Filter (KF) basierte
Herangehensweise. Die theoretischen Grundlagen von KF-Algorithmen
sind durch ver- schiedenartige Anwendungsbeispiele, im allgemeinen
Bereich der EKG-Verarbeitung, gegeben. Diese Arbeit begrundet die
Sinnhaftigkeit weiterer Forschungen am Institut mit diesem Ver-
fahren.
Daruber hinaus wird die bestehende Zusammenarbeit zwischen dem IBMT
und dem Univer- sitatskrankenhaus Leipzig fortgefuhrt. Der
Algorithmus kann damit, neben simulierten Daten, auch an
Patientendaten, welche am Universitatsklinikum aufgenommen wurden,
getestet wer- den.
Zum Schluss werden die erreichten Ergebnisse der bereits
entwickelten Methode gegenuber- gestellt. Der KF-basierte Entwurf
ist nicht nur imstande das fEKG erfolgreich aus abdomi- nal
gewonnenen Daten zu extrahieren, es hat sich außerdem gezeigt, dass
er robuster als das vorherige Verfahren ist.
Final Project - Marcos Cruz Santiago iv
Resumen
Las enfermedades del corazon son la causa de muchas muertes
prenatales, en el parto o durante los primeros meses de vida. Por
lo tanto, el estudio de las senales cardacas fetales puede ser muy
beneficioso para evaluar el estado del corazon del feto con motivo
de detectar rapidamente anomalas cardacas.
La reciente tendencia en la obtencion de electrocardiogramas
fetales (fECG) es grabar senales de manera no invasiva, usando
electrodos superficiales ubicados en el abdomen materno. La
extraccion del componente fetal a partir de esas grabaciones
abdominales se trata de una tarea complicada debido a la pequena
energa del fECG, la cual a menudo, es enmascarada debido al
electrocardiograma materno y a las fuentes de ruido.
A pesar de que un metodo de extraccion para este proposito fue
desarrollado en el IBMT basado en el Event Synchronous Canceller
(ESC), los resultados obtenidos no fueron aun lo suficientemente
precisos. Por lo tanto, este presente estudio contempla la
posibilidad de la im- plementacion de un metodo que pueda mejorar
los anteriores resultados obtenidos. El esquema elegido a
implementar en este trabajo es uno basado en filtro de Kalman (KF).
Ademas se presenta una base teorica del algoritmo del KF y varios
ejemplos de su uso en el area gen- eral del procesamiento de ECG.
Este trabajo establece la posibilidad de nuevas investigaciones
relacionados con esta tecnica en el departamento de IBMT.
Este proyecto continua la colaboracion entre IBMT y el hospital
universitario de Leipzig, y por lo tanto, el algoritmo no solo ha
sido probado con datos simulados sino que tambien lo ha sido con
datos reales obtenidos en dicho hospital.
Finalmente, los resultados obtenidos han sido contrastados y
comparados con los conseguidos por el metodo anterior desarrollado
en este departamento. El esquema basado en KF no solo ha sido capaz
de extraer satisfactoriamente el fECG de las grabaciones
abdominales, sino que tambien ha mostrado ser mas robusto que el
esquema anterior.
Final Project - Marcos Cruz Santiago v
Resum
Les malalties del cor son la causa de moltes morts prenatals, en el
part o durant els primers mesos de vida. Per tant, l’estudi dels
senyals cardaques fetals pot ser molt beneficios per avaluar
l’estat del cor del fetus amb motiu de detectar rapidament
anomalies cardaques.
La recent tendencia en l’obtencio de electrocardiogrames fetals
(fECG) es gravar senyals de manera no invasiva, usant electrodes
superficials ubicats a l’abdomen matern. L’extraccio del component
fetal a partir d’aquestes gravacions abdominals es tracta d’una
tasca com- plicada a causa de la petita energia del fECG, la qual
sovint, es emmascarada a causa de l’electrocardiograma matern i a
les fonts de soroll.
Tot i que un metode d’extraccio per a aquest proposit va ser
desenvolupat a l’IBMT basat en el Event Synchronous canceller
(ESC), els resultats obtinguts no van ser encara prou precisos. Per
tant, aquest present estudi contempla la possibilitat de la
implementacio d’un metode que pugui millorar els anteriors
resultats obtinguts. L’esquema triat a implementar en aquest
treball es un basat en el filtre de Kalman (KF). A mes es presenta
una base teorica de l’algorisme del KF i diversos exemples del seu
us en l’area general del processament d’ECG. Aquest treball
estableix la possibilitat de noves investigacions relacionats amb
aquesta tecnica en el departament de IBMT.
Aquest projecte continua la col·laboracio entre IBMT i l’hospital
universitari de Leipzig, i per tant, l’algorisme no nomes ha estat
provat amb dades simulades sino que tambe ho ha estat amb dades
reals obtingudes en aquest hospital.
Finalment, els resultats obtinguts han estat contrastats i
comparats amb els aconseguits pel metode anterior desenvolupat en
aquest departament. L’esquema basat en KF no nomes ha estat capac
d’extreure satisfactoriament el fECG dels enregistraments
abdominals, sino que tambe ha mostrat ser mes robust que l’esquema
anterior.
Final Project - Marcos Cruz Santiago vi
Contents
List of Abbreviations xiv
1. Introduction 1 1.1. Motivation . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 1 1.2. Aim of the Work
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . 1 1.3. Brief Overview of this Work . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 2
2. State of the Art 3 2.1. Introduction . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2. Kalman
Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . 4
2.2.1. Kalman Filter Formulation . . . . . . . . . . . . . . . . .
. . . . . . . . . 5 2.2.2. Extended Kalman Filter . . . . . . . . .
. . . . . . . . . . . . . . . . . . . 21 2.2.3. Extended Kalman
Smoother . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.4. Other variants . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . 26
2.3. Application of Kalman Filters in ECG processing . . . . . . .
. . . . . . . . . . . 29 2.3.1. ECG denoising . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 29 2.3.2. Parameters
estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 31 2.3.3. Other related uses . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 33
3. Implementation 34 3.1. Test Data . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . 34
3.1.1. Simulated Data . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . 34 3.1.2. Real Data . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 35
3.2. Extraction Method . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 40 3.2.1. Preprocesing . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.2.
Observation Equations . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . 42 3.2.3. Dynamic ECG Model . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . 43 3.2.4. Maternal ECG filtering . .
. . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.2.5. fECG
subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . 52 3.2.6. Peak detection . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . 52
3.3. Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . 53
4. Results 55 4.1. Results on Simulated Data . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . 55
4.1.1. Results with different noise sources . . . . . . . . . . . .
. . . . . . . . . . 55 4.1.2. Results with different wrapping times
. . . . . . . . . . . . . . . . . . . . 58
4.2. Results with different peak detectors . . . . . . . . . . . .
. . . . . . . . . . . . . 59
vii
Contents
4.3. Results on Real Data . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 59 4.4. Results with different filter
methods . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.4.1. Results of EKF towards EKS . . . . . . . . . . . . . . . . .
. . . . . . . . 61 4.4.2. Results of EKS towards ESC . . . . . . .
. . . . . . . . . . . . . . . . . . 62
5. Discussion and Conclusions 66 5.1. Discuss of the Results . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
66
5.1.1. General performance . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . 66 5.1.2. Noise sources evaluation . . . . . .
. . . . . . . . . . . . . . . . . . . . . . 69 5.1.3. Optimal time
of phase wrapping . . . . . . . . . . . . . . . . . . . . . . . 71
5.1.4. Influence of the peak detector . . . . . . . . . . . . . . .
. . . . . . . . . . 71 5.1.5. Comparison between different methods
. . . . . . . . . . . . . . . . . . . . 71
5.2. Future works on this Field . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . 74 5.2.1. System improvement . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . 74 5.2.2.
Improvement on QRS detector . . . . . . . . . . . . . . . . . . . .
. . . . 74 5.2.3. Multichannel approach . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . 74
5.3. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . 74
A. Publication a
List of Tables
3.1. Noise sources from abdominal recordings characterization. . .
. . . . . . . . . . . 34 3.2. Channels used in annotations of real
data signals . . . . . . . . . . . . . . . . . . 38 3.3. Model
parameters table . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . 50
4.1. Sensitivity for fixed wrapping time in different simulated
noise sources for EKS filtering . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . 56
4.2. Exemplary statistics for one specific noise source,
fetal-maternal SNR and band- width . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3. Comparison of sensitivity and positive predictivity of EKS
with a different peak detector . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . 59
4.4. Channels used in annotations of real data signals . . . . . .
. . . . . . . . . . . . 60 4.5. Resulting statistics for real data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4.6.
Sensitivity and positive predictivity for fixed wrapping time for
EKS and EKF . 61 4.7. Comparison of sensitivity and positive
predictivity between ESC and EKS . . . . 64
5.1. Number of overlapping maternal and fetal R-peaks over the
various datasets . . . 67 5.2. Sensitivity and positive
predictivity for ESC and EKS with a different peak detector
73
ix
List of Figures
2.1. General scheme of Kalman filter variants . . . . . . . . . . .
. . . . . . . . . . . . 5 2.2. Typical Kalman filter application .
. . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3. Example
of conditional probability density . . . . . . . . . . . . . . . .
. . . . . . 7 2.4. Typical system bandpass curve on a plot of power
spectral density vs frequency . 8 2.5. Conditional density of
position based on an observed measurement, zt1 . . . . . . 9 2.6.
Conditional density of position based on measurement zt2 . . . . .
. . . . . . . . 10 2.7. Conditional density of position based on
data zt1 and zt2 . . . . . . . . . . . . . . 11 2.8. Propagation of
conditional probability density . . . . . . . . . . . . . . . . . .
. . 12 2.9. A representation of a linear system . . . . . . . . . .
. . . . . . . . . . . . . . . . 14 2.10. Model underlying the
Kalman filter . . . . . . . . . . . . . . . . . . . . . . . . . .
15 2.11. The ongoing discrete Kalman filter cycle . . . . . . . . .
. . . . . . . . . . . . . . 18 2.12. A complete picture of the
operation of the Kalman filter . . . . . . . . . . . . . . 20 2.13.
Example of error covariance vs iterations in a attempt to estimate
a scalar random
value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 20 2.14. Estimation of a constant value
using with a correct estimated error covariance . . 21 2.15.
Estimation of a constant value using with a high estimated error
covariance . . . 22 2.16. Estimation of a constant value using with
a low estimated error covariance . . . 23 2.17. A complete scheme
of the operation of the Extended Kalman filter . . . . . . . . 26
2.18. Scheme with some of the most used Kalman filter variants . .
. . . . . . . . . . . 27 2.19. ECG denoising example using a
Bayesian filtering framework . . . . . . . . . . . 30 2.20. General
method for deriving heart rate and blood pressure . . . . . . . . .
. . . . 32
3.1. Example of resulting simulated datasets. . . . . . . . . . . .
. . . . . . . . . . . . 36 3.2. Diagram of the new data from
Leipzig configuration of the electrodes . . . . . . . 37 3.3.
Screenshot of the program and example of the procedure to make
manual anno-
tations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 38 3.4. Example of annotation procedure in
case of evidences of peaks. . . . . . . . . . . 39 3.5. Example of
annotation procedure in case of no evidences of peaks. . . . . . .
. . 39 3.6. Block scheme of a complete system of fECG extraction. .
. . . . . . . . . . . . . 41 3.7. Block scheme of a ECG processing
block . . . . . . . . . . . . . . . . . . . . . . . 41 3.8. Input
parameters for EKF/EKS. . . . . . . . . . . . . . . . . . . . . . .
. . . . . 43 3.9. Synthetic ECG generated for test purposes . . . .
. . . . . . . . . . . . . . . . . 44 3.10. Phase Alignment example
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.11. Phase Wrapping example of abdominal recordings . . . . . . .
. . . . . . . . . . 48 3.12. Model estimation example . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . 49 3.13. Example
with inadequate number of Gaussians to construct the model. . . . .
. 50 3.14. Maternal ECG subtraction from preprocessed data to
obtain the estimated fetal
ECG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . 52
4.1. Behavior for one specific noise source: EM. . . . . . . . . .
. . . . . . . . . . . . 56 4.2. Behavior for one specific noise
source: MA. . . . . . . . . . . . . . . . . . . . . . 57 4.3.
Statistical results for different wrapping times . . . . . . . . .
. . . . . . . . . . . 58
x
List of Figures
4.4. Real data processing example . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 61 4.5. Behavior of EKF and EKS while
extracting fetal components from abdominal
recordings. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 62 4.6. Analogy between the extraction
schemes based on ESC and EKS . . . . . . . . . 63 4.7. Comparison
in the behavior of ESC and EKS . . . . . . . . . . . . . . . . . .
. . 65
5.1. Missdetected overlapped peak . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 67 5.2. Erroneous behavior while extracting
maternal component . . . . . . . . . . . . . 68 5.3. Error in peak
detections while having big artifacts . . . . . . . . . . . . . . .
. . 70
Final Project - Marcos Cruz Santiago xi
Symbols
µ ........................................ Mean σ
........................................ Standard deviation σ2
........................................ Variance or second order
statistic E[x] ........................................ Expectation
of a random variable x vk ........................................
Stochastic process associated to the sys-
tem uk ........................................ Known input vector
wk ........................................ Stochastic process
associated to the mea-
sure xk ........................................ State of a
discrete-time process x0 ........................................
Initial value of the state of a discrete-time
process x−k ........................................ A priori state
estimate at step k of xk xk
........................................ A posteriori state
estimate at step k of xk xk
........................................ Approximate system state
vector at step
k zk ........................................ Output or the
observation of a discrete-
time system zk ........................................ Approximate
measurement vector at step
k A ........................................ State transition model
which is applied to
the previous state xk−1 B ........................................
Control-input model which is applied to
the control vector uk H ........................................
Observation model which maps the true
state space into the observed space uk Qk
........................................ Process noise covariance
of the stochastic
process associated to the measure Rk
........................................ Process noise covariance
of the stochastic
process associated to the system e−k
........................................ A priori estimate error ek
........................................ A posteriori estimate
error exk
........................................ Prediction error ezk
........................................ Measurement residual P−k
........................................ A priori estimate error
covariance at step
k P k ........................................ A posteriori
estimate error covariance ma-
trix at step k P 0 ........................................ Initial
value of the posteriori estimate er-
ror covariance matrix k
List of Figures
Kk ........................................ Kalman gain or blending
factor at step k I ........................................
Identity matrix k Tr ........................................ Trace
operator over a Matrix xk ........................................
Approximate state of a discrete-time pro-
cess zk ........................................ Approximate
measurement or output of a
discrete-time system Ak ........................................
Jacobian matrix of partial derivatives of f
with respect to x W k ........................................
Jacobian matrix of partial derivatives of f
with respect to w Hk ........................................
Jacobian matrix of partial derivatives of h
with respect to x V k ........................................
Jacobian matrix of partial derivatives of h
with respect to v f(·) ........................................
Non-linear function of the state evolution h(·)
........................................ Non-linear function that
describes the re-
lationship the state evolution and the ob- servations
θk ........................................ Phase system state φk
........................................ Phase observation in form
of maternal ref-
erences ai ........................................ Amplitude of
the Gaussian terms that
form the KF’s dynamic model bi
........................................ Width of the Gaussian
terms that form
the KF’s dynamic model η ........................................
Random additive noise that models the in-
accuracies of the dynamic model ω
........................................ Angular frequency required
for the dy-
namic model sk ........................................ Observation
measurements in the dy-
namic ECG model T ........................................
RR-interval period in each ECG cycle twrap
........................................ Wrapping time in seconds
Navg ........................................ Number of averaged
beats in the ESC
method fxti |zt1 ,zt2 ...zti (x|z1, z2 . . . zi)
........................................ Conditional probability
density of a ran-
dom variable x in a time instant i, condi- tioned to the knowledge
of the value of the vector of observation measurement z in
different time steps t1, t2 . . . ti. z1, z2 . . . zi relate the
values of the observation mea- surements.
Final Project - Marcos Cruz Santiago xiii
List of Abbreviations
Acc .................................................... Accuracy
AR ....................................................
Autoregressive process bWa
.................................................... Baseline
wander ECG ....................................................
Electrocardiogram EHG
....................................................
Electrohysterography EKF
.................................................... Extended
Kalman filter EKS
.................................................... Extended
Kalman smoother EM
.................................................... Electrode
Motion EMG ....................................................
Electromyographic ESC
.................................................... Event
synchronous canceller fECG
.................................................... Fetal
Electrocardiogram fHR
.................................................... Fetal heart
rate FIR ....................................................
Finite impulse response GUI
.................................................... Graphic User
Interface ICA ....................................................
Independent Component Analysis KF
.................................................... Kalman filter
MA .................................................... Muscular
Artifact mECG ....................................................
Maternal Electrocardiogram MMSE
.................................................... Minimum mean
square error NRSDB
.................................................... Normal Sinus
Rhythim Database Se
.................................................... Sensitivity
SNR .................................................... Signal to
noise ratio UKF
.................................................... Unscented
Kalman Filter +P
.................................................... Positive
Predictivity Value
xiv
1. Introduction
1.1. Motivation
The assessment of the heart activity represents an integral part in
the prenatal medicine. Into this area, the fetal ECG (fECG)
provides a mean to characterize the functional state of the fetal
heart. Within this topic a field of actual research and a recent
trend in the case of fetal status evaluation is to record signals
in a non invasive way, using surface electrodes placed on the
maternal abdomen. Therefore the derivation of the fECG from
abdominal recordings became a considerable research area. The most
important parameter derived from fECG is fetal heart rate (fHR)
[59]. It allows physicians to examine the evolution of the fetus,
and classify arrhythmias as well as identify possible heart
diseases. Fortunately the fHR can be derived from abdominal
recordings.
However this extraction remains as an important problem for the
biomedical engineering community, due to the low energy content of
the fECG and to the existence of noise and artifacts in the
measurements, particularly the maternal ECG (mECG) interference.
Unfortunately, fECG and mECG are superimposed in time and frequency
which makes the extraction of the fECG from abdominal recordings a
challenging task. Thus some interesting clinical applications lack
reliable signal processing tools to extract the weak fECG
components contaminated with background noise.
A previous work at IBMT [4] showed the possibility to extract the
fECG. Moreover, an extraction system was build by applying template
subtraction. The proposed method represents a very promising non
invasive manner of to evaluating the state of the fetus. However,
since the developed scheme was still not working perfectly in all
the situations, more work had to be done in this area.
Therefore, an alternative approach to extract the fECG should be
developed and a comparison between both methods performed. For the
sake of comparison, a Kalman filter (KF) based approach was chosen.
The choice of KF was derived from the old work, due to its good
results, its optimality and structure. Since this is the first work
from IBMT with KF, it not only tries to deal with fetal extraction,
but the work also tries to provide the background regarding KF
basics as well as an overview of usage of KF in ECG processing,
opening the possibility of future projects within this
department.
This work has been developed at the IBMT from the Technische
Universitat Dresden (TU Dresden). Thereby, the work continues the
collaboration between IBMT and the University Hospital of Leipzig,
as the real patient-related data were performed and obtained at the
Uni- versitatsfrauenklinik Leipzig.
1.2. Aim of the Work
As mentioned before, this work is going to deal two main topics: KF
basics and fECG extraction. Regarding the first point and aiming to
enable future works from IBMT, the presented study gives a detailed
explanation about KF basics, so it can be used as reference for
future works. Also, a bibliographical research is presented in
order to depict the various usages of KF in ECG processing.
Regarding the second point, half of this work is focused on
describing a method able
1
CHAPTER 1. INTRODUCTION
to extract the fECG component from an abdominal recording along
with tests and the study of the obtained results.
The aim of this project is, therefore, to cover the following
topics:
• Literature research on the applications of Kalman filtering
techniques in automated ECG processing;
• Implementation of a Kalman filter approach to extract the fetal
ECG from abdominal recordings;
• Editing of abdominal recordings which are derived from
Universtatsklinik Leipzig;
• (Comparative) evaluation of the usability of the implemented
method to extract the fetal ECG.
1.3. Brief Overview of this Work
In the first chapter, an introduction to the work is delineated.
Furthermore, motivation that lead to this study is given. Also, the
objectives of the work and a brief overview of the structure of the
work are given.
On chapter 2 “State of the Art”, an introduction is done regarding
the different methods applied in fECG processing. Moreover, a
theoretical background of Kalman framework is given. Alongside,
different usages of KFs in ECG processing are indicated.
In “Implementation”, chapter 3, is described the method to extract
fECG from abdominal recordings. Within this chapter, also the data
used and its obtaining is described. Furthermore, the criterion and
the methods for evaluating the results are detailed.
Then in chapter 4 results obtained with the purposed method
described within this work are shown. Also comparative results
between Kalman filtering and ESC method is held.
At last, in Chapter 5 “Discussion and Conclusions”, results are
discussed. The discussion analyzes weak points of the methods as
long as suggestions for improve the described method. Finally, a
discussion of future works that can arise from this work and
conclusions that arise from the work are presented.
Final Project - Marcos Cruz Santiago 2
2. State of the Art
In this chapter, the current state of KF applicability and KF bases
are stated. First a brief overview of the different existing
techniques for extracting fECG from abdominal recordings is held in
section 2.1. Section 2.2 deals with KF theoretic bases. Finally, in
section 2.3 possible applications of KF in ECG processing are
discussed.
2.1. Introduction
The extraction of fECG from abdominal recordings has been recently
an intense field of re- search. It supposes a great challenge due
to the low amplitude of the desired signal. Moreover, mECG
represents a huge obstacle in the acquisition of fECG, as it is
overlapped in time and frequency. Also the presence of numerous non
cardiac ECG contaminants, such as electromyo- graphic (EMG) noise,
that overlap with the cardiac components in the frequency domain
com- plicate the processing. Bandpass filtering is therefore
inadequate to suppress such contaminants.
Nevertheless, there are several approaches for the extraction of
small cardiac components in high noise environments. However, due
to the rather old history of the problem and the rich literature in
this field, it is not possible to cover all the existing methods in
detail. Nevertheless in this section some of the most commons
approaches and their main drawbacks and benefits are briefly
described. An extended literature review can be found in [4].
In early works, fECG detection was done over raw data without any
previous processing. In some special cases fetal R-Peaks were
reported in which due to vertex presentation of the fetus, peaks
appeared as positive peaks while maternal peaks had negative peaks.
In such cases, the detection of the fetal RR intervals is rather
simple and may be achieved by simple peak detection, as Larks
suggested [30], even without any kind of preprocessing.
Another suitable technique is ensemble averaging of maternal beats
in order to subtract a clean mECG to create a template. Then this
template is subtracted from abdominal recordings in order to get
the fECG. However this technique requires the average of many beats
losing in the process important inter-beat variations of the
cardiac cycle. As an improvement of ensemble averaging some
classical adaptive filters appeared as possible architectures to
cancel out noise. Moreover, a very similar group of techniques
derived from ensemble averaging also exist. The event synchronous
canceller (ESC) is a method that belongs to this group. It was
developed by Ungureanu [64], Andreotti’s version [4] states the
precursor of this work.
Due to the non stationary nature of the cardiac signal, techniques
as the Wiener filter are discarded in the ECG processing field.
However Wiener filter was designed to work in scenarios in which a
signal is overlapped both in time and frequency with noise sources
and also it can be applied either in a casual sense in the
time-domain or as the non casual case in the frequency domain [48].
Nevertheless, Wiener filter was designed to work with stationary
signals. Under the restriction of work Wiener Filter is the optimal
linear filtering technique in the Minimum Mean Square Error (MMSE)
sense [27]. Unfortunately, the Wiener Filter is not expected to
give good results for a noisy ECG.
Another possibility is the Wavelet Denoising, which had become a
common practice for de- noising signals with multiresolution
characteristics such as abdominal recordings signal in the ECG
[15].
3
CHAPTER 2. STATE OF THE ART
Statistical techniques such as Principal Component Analysis [38],
Independent Component Analysis (ICA) and Neural Networks have also
been used to extract a statistical-based model of the signal and
noise, allowing the removal of noise by discarding the dimensions
corresponding to noise. Although these are powerful noise filtering
schemes and some interesting works are being developed with this
technique, the model seems to be fairly arbitrary and can be
extremely sensitive to small changes in either the signal or the
noise. Furthermore, the number of electrodes or channels can be
also a problem for methods such as ICA, as they require a minimum
number of channels to work.
Nonlinear projective filtering [55], is another similar method of
forming an ad hoc statistical model of the ECG. Although is a
method extremely powerful, is extremely computationally intensive
and highly sensitive to outliers and changes in data [23].
Finally, adaptive filters are techniques capable of adapting
themselves to different spectral shapes and temporal
non-stationarities. From the filtering point of view this filters
move the poles and zeros of their transfer functions according to
the signal and noise contents of the input signal and the prior
model of the signal dynamics [50]. There are some filters, in
which, some model of the cardiac signal is constructed (either
explicitly or implicitly), and used as a reference signal to
constrain the filter to improve the signal-noise separation
performance. One of such techniques is Bayesian filtering framework
which includes Kalman Filters.
2.2. Kalman Framework
In 1960, R.E Kalman wrote his well-known paper describing a
recursive solution to the discrete data linear filtering problem
[24]. Since that time, Kalman filtering and its applications have
been the subject of extensive research in large part because of the
improvements in digital computing.
Kalman filtering is a method capable to estimate hidden states of a
system, that are observ- able through a set of measurements.
Moreover, it is proven that KF it is the optimal filter minimizing
the minimum mean square error (MMSE) [25] between the state of the
system and its estimated value, under certain general constraints:
linear system model, white noise and Gaussian amplitude
distribution of noise (justified in section 2.2.1.2).
One of these constraints states that the noise’s amplitude
distribution should be Gaussian. Nevertheless, if the noise is not
Gaussian with given only the mean and standard deviation of noise,
the KF is the best linear estimator.
There are some reasons that make Kalman Filtering widely used, some
of the most important ones are the following [26, 66]:
• It achieves good results in practice due to optimality and its
structure.
• It is convenient for online real time processing.
• It is easy to formulate and implement given a basic
understanding.
• Measurement equations do not need to be inverted.
• It supports estimations of past, present, and even future
states.
• It can do so even when the precise nature of the system’s model
is unknown.
Conventional KF assumes a linear model for the system dynamics and
observation equations. However, in fact, real systems tend to be
nonlinear, so for such systems, several variants of the original KF
have been developed. In fig. 2.1 a scheme of the most used KF
variants is depicted. A explanation of these different types of
variants is contained in section 2.2.4.
Final Project - Marcos Cruz Santiago 4
CHAPTER 2. STATE OF THE ART
Kalman filter
Sparse matrices
Figure 2.1.: General scheme depicting the main division groups of
Kalman filter variants.
In this section a review on Kalman Basics is contained as well as
some of the most important variants in the KF family.
2.2.1. Kalman Filter Formulation
KF is a recursive data processing algorithm. It is going to be
shown in this section that under certain assumptions, KF is
optimal. One aspect that contributes to its optimality is that the
KF incorporates all information that can be provided to it. KF
processes all available data, regardless of their degree of
reliability 1, to estimate the current value of the variables of
interest, by incorporating the following [14]:
• Knowledge of the system and measurement device dynamics.
• The statistical description of the system noises, measurement
errors, and uncertainty in the dynamics models.
• Any available information about initial conditions of the
variables of interest.
In the previous description is indicated that KF follows a
recursive scheme. This relates that, unlike certain data processing
concepts, KF does not require all previous processed data to be
kept in storage and reprocessed every time a new observation
measurement is taken. This recursive characteristic is importance
for the filter implementation because it makes its structure
simpler and also it allows the filter to work faster as it works
with less data.
KF could be used advantageously in situations in which: a system of
some sort is driven by some known controls, and measuring devices
provide the value of certain pertinent quantities. KF goal is to
estimate these parameters by using the available data. The
parameters involved in the process are depicted in fig. 2.2. They
are the following ones:
• System state: Also called hidden system state, as it cannot be
measured directly. This parameter describe the state of the system
system and it is composed by some finite number of parameters.
System state represent the desired values of the system. In order
to obtain the system state, it must be estimated.
• Controls: The system can be driven by some sort by some known
controls.
• System error sources: A system is affected to some degree by
noise, biases, and device inaccuracies.
1KF is able to merge all available data and extract information
from each data source. A different level of trust is put in every
source according to how noisy is this data.
Final Project - Marcos Cruz Santiago 5
CHAPTER 2. STATE OF THE ART
Figure 2.2.: Typical Kalman filter application. A system of some
sort with a hidden and de- sired system state is driven by some
known controls, and measuring devices. The dashed box represent a
black box. Only inputs (controls) and outputs (observed
measurements) are explicitly available from the physical system.
[44].
• Observed measurements: The system can be measured by a certain
number of different devices, each with its own particular dynamics
and error.
• Measurement error sources: Any measurement is corrupted to some
degree by noise, biases, and device inaccuracies.
To sum up, the whole system can be considered as a black box ruled
by some known inputs (controls) and it produce some outputs
(observed measurements), being them all that can be explicitly
available from the physical system. Estimating the hidden system
state uses to be complicated by the certainty that the system is
usually having more inputs than known controls: noise and uncertain
controls. The relationships among this various system state
variables and the measured observations are known only with some
degree of uncertainty. Besides, the system can be measured by
different measuring devices, each with its own particular dynamics
and error characteristics. Thus, each of this measuring device is
going to provide some information about a particular variable. It
would be advantageous to merge their outputs in a systematic and
optimal manner.
A KF combines all available measurement data and the prior
information about the system and measuring devices. In that way, KF
is able to generate an estimate of the desired variables in such a
way that the error is minimized statistically.
2.2.1.1. Bayesian viewpoint
The KF can be considered to be a kind of the simplest dynamic
Bayesian networks [33]. Bayesian networks are methods of estimation
in which Bayes’ rule (see equation 2.1, P (A) and P (B) relates
some random probabilities and P (B|A) and P (B|A) the conditional
probability between them) is used to update the probability
estimate for a hypothesis as additional evidence is learned [16].
These frameworks (and specifically KF) calculate estimates of the
hidden system state over time using observed measurements and a
mathematical process model.
Final Project - Marcos Cruz Santiago 6
CHAPTER 2. STATE OF THE ART
Figure 2.3.: Example of a conditional probability density of the
value of a fixed scalar quantity x at time instant ti (xti),
conditioned on knowledge that the vector measurement zt1 and also
for instants between t2 to ti, plotted as a function of possible
xti) values. [34].
P (A|B) = P (B|A)P (A)
P (B) (2.1)
Conceptually, what any type of filter tries to do is obtain an
optimal estimate of some values or variables from data provided by
a noisy environment. Optimal meaning that the filter minimizes
errors under some criterion. There are many manners of
accomplishing this objective, if a Bayesian viewpoint2 for the
filter is adopted, then it is desired that the filter propagates
the conditional probability density of the aimed quantities,
conditioned on knowledge of the actual observed measurements
[34].
To review briefly the concept explained in the last paragraph, fig.
2.3 gives an example of a probability density of a random variable
x in a time instant i. This random variable is conditioned to the
knowledge of the value of the vector of observation measurement z
in different time steps t1, t2 . . . ti. z1, z2 . . . zi relate the
values of the vector of observation measurements. It is termed
probability density because its shape and location on the x axis is
dependent on the values of the measurements taken. It is noted as
the following fxti |zt1 ,zt2 ...zti (x|z1, z2 . . . zi). Its shape
transmit the amount of certainty that is contained in the knowledge
of the value of x. If the shape of the density plot is a narrow
crest, then the probability weight is mostly concentrated in a
narrow band of x values. Otherwise, if the plot has a dispersed
shape, the probability weight is expanded over a wider range of x.
In other words, the probability weight of x taking a certain value
is lower [34].
2.2.1.2. Basic Assumptions
Once such a conditional probability density function is propagated,
the optimal estimate can be defined. KFs perform this conditional
probability density propagation under certain basic assumptions.
They are the following ones:
2Bayesian inference may be viewed as an iterative process in which
Bayes’ theorem is used to update how trusty a variable is when
evidence (actual observed measurements) becomes available.
Final Project - Marcos Cruz Santiago 7
CHAPTER 2. STATE OF THE ART
Figure 2.4.: A typical system bandpass curve is drawn on a plot of
power spectral density versus frequency [34]
• The system can be described through a linear model.
• System and measurement noises are white noises.
• System and measurement noises have Gaussian amplitudes.
Under these constraints, the KF is shown to be the best filter of
any conceivable form [34]. Some of the restrictions can be relaxed,
yielding a qualified optimal filter. For instance, if the Gaussian
assumption is removed, the KF can be shown to be the best filter,
in the minimum error variance sense, out of the class of linear
unbiased filters.
On first inspection, the main three assumptions (linear system,
white noise, Gaussian am- plitude distribution) may appear to be
overly restrictive and unrealistic. However, they can be justified
for many potential applications and they are discussed in detail in
the following paragraphs.
Usually, a linear system model is justifiable for a number of
reasons. Often such a model is adequate for the purpose at hand,
and when nonlinearities do exist, a typical engineering approach is
to linearize about some nominal point or trajectory, achieving a
perturbation model or error model. In fact, linear systems are
desirable as they are more easily manipulated with engineering
tools. Moreover linear system theory is much more complete and
practical than nonlinear one [34]. As it has been introduced in
2.2, there are means of extending the Kalman filter concept to some
nonlinear applications or developing nonlinear filters directly,
but these are considered only if linear models prove to be
inadequate.
Whiteness constraint of the noise implies that the noise value is
not correlated in time and also that it has equal power at all
frequencies. Since this results in a noise with infinite power, a
white noise obviously cannot really exist. Nevertheless, the choice
of a white noise model can be justified in two ways: First, any
physical system of interest has a certain frequency bandpass3.
Thus, it is driven by wideband noise, having power at frequencies
above the system bandpass, and essentially constant power at all
frequencies within the system bandpass, as it is shown in fig. 2.4.
On this same plot, a white noise would merely extend this constant
power level out across at frequencies. Within the bandpass of the
system of interest, the fictitious white noise looks identical to
the real wideband noise. Secondly, it turns out that the
mathematics involved in the filter are vastly simplified. Thus,
mathematics become manageable by replacing the real wideband noise
with a white noise which, from the system’s point of view, is
identical. Therefore, a white noise model can be considered.
3A frequency range of inputs to which it can respond. Above this
range, the input either has no effect, or the system so severely
attenuates the effect that it essentially does not exist.
Final Project - Marcos Cruz Santiago 8
CHAPTER 2. STATE OF THE ART
Figure 2.5.: Conditional density of position based on an observed
measurement, zt1 [34]
It can be argued that there are cases in which the noise power
level is not constant over all frequencies within the system
bandpass, or in which the noise is in fact time correlated.
Nevertheless, for such instances, some solutions exists. White
noise can be put through a shaping filter that can duplicate
virtually any form of time-correlated noise [34]. The objective of
this technique is to achieve overall linear system driven by white
noise once again.
The last constraint has to do with the Gaussianes of the noise
amplitude. The probability density of a Gaussian noise amplitude
may take the shape of a normal bell-shaped curve. This assumption
can be justified by the fact that a system or measurement noise is
typically caused by a number of small sources. It can be
demonstrated that when a number of independent random variables are
added together, the summed effect can be approximated very closely
by a Gaussian probability density, regardless of the shape of the
individual densities [11]. Moreover, the Gaussian densities
assumption, as in the case of whiteness, makes mathematics
manageable [25].
2.2.1.3. The Probabilistic Origins of the Filter
To understand the probabilistic origins of the filter and how KFs
work, a simple example (based on the one described in Maybeck [34])
is developed in this section. Suppose that it is searched for a
single value, for instance, the exact position x of an object in a
one-dimensional location. Consider now that at some time t1 it is
possible to measure the position of the object with a certain
sensor, calling this observed measurement: zt1 . However, because
of device inaccuracies and errors of the sensor, the result of the
measurement zt1 is somewhat uncertain. The precision is such that
the standard deviation involved is σzt1 . In other words, the
variance, or second order statistic, is σ2zt1
. Thus, the conditional probability of xt1 , the position of the
object at time t1, conditioned on the observed value of the
measurement being zt1 can be established.
Fig. 2.5 depicts these values. It is a plot of fxt1 |zt1 (x|z1) as
a function of the location x, in other words, it shows the
probability for the object of being in any location, based upon in
the measurement taken. Note that σzt1 is a direct indicator of the
uncertainty: the larger σzt1 is, the broader the probability peak
is, spreading the probability “weight” over a larger range of x
values4 [66]. The best possible estimate of the position based on
this conditional probability density is the following one:
4For a Gaussian density, 68,3% of the probability “weight” is
contained within the band σ units to each side of the mean
[39].
Final Project - Marcos Cruz Santiago 9
CHAPTER 2. STATE OF THE ART
Figure 2.6.: Conditional density of position based on measurement
zt2 [34]
xt1 = zt1 (2.2)
Te variance of the error of this estimate is defined as
follows:
σ2xt1 = σ2zt1
(2.3)
Now it can be considered that the system receives measure from the
sensor at time t2 ∼= t1 (so that the real position has not changed
at all), and it is obtained a measurement zt2 with a variance
σ2zt2
. The variance of the new measurement may be different from the
first one, for instance can be smaller than the first measure, or
in other words, more accurate. Fig. 2.6 shows a possible form of
fxt2 |zt2 (x|z2) for this hypothesis. Note the peak has a narrow
shape, this is due to smaller variance. This shape indicates that
the position is rather certain based on the new measurement.
Now, having different measurements for estimating the position, the
next step is to combine this data. Subsequently is shown that,
based on the previous assumptions, the conditional density of the
position at time t2 ∼= t1, given both zt1 and zt2 , is a Gaussian
density with mean µ and variance σ2, with:
µ = [ σ2zt2
σ2zt1 + σ2zt2
]zt1 + [ σ2zt1
σ2zt1 + σ2zt2
]zt2 (2.4)
σ2zt2 (2.5)
Note that, from equation 2.5, σ is less than either σzt1 or σzt2 .
In other words, the uncertainty in the estimate of position has
been lowered by combining the two pieces of information (as it is
shown in fig. 2.7 graphically). Therefore, given this density, the
best estimate is:
xt2 = µ (2.6)
with an associated error variance σ2. Note in equation 2.4, if σzt1
is equal to σzt2 . This means that both measurements are of equal
precision, the equation shows that the optimal estimate of position
is simply the average of the two measurements, as would be expected
[34]. Even, if
Final Project - Marcos Cruz Santiago 10
CHAPTER 2. STATE OF THE ART
Figure 2.7.: Conditional density (fxt2 |zt1 ,zt2 (x|z1, z2)) of
position based on data zt1 and zt2 [34]
σzt1 is larger than σzt2 , which is to say that the uncertainty
involved in the measurement zt1 is greater than that of zt2 , then
the equation dictates “weighting” zt2 more heavily than zt1
[34].
Finally, even if σzt2 is less than σzt1 , or if σzt2 is very large,
the estimation will be improved. Therefore poor quality data also
provide information. In consequence, it should increase the
performance of the filter output.
Furthermore, equation 2.4 and equation 2.5 are also the weighted
least squares estimate, the maximum likelihood estimate, and the
linear estimate with less than any other linear unbiased estimate.
Hence, it is the “best” that can be done according to just about
any reasonable criterion [34].
Too see the relationship with the KF algorithm, the equation for
xt2 can be rewritten as:
xt2 = [ σ2zt2
σ2zt1 + σ2zt2
]zt1 + [ σ2zt1
σ2zt1 + σ2zt2
[zt2 − zt1 ] (2.7)
Grouping the variances from equation 2.7 is possible to define the
following K term:
Kt2 = σ2zt1
σ2zt1 + σ2zt2
(2.8)
Note that the subscript of K refers to the newest measurement
available, or in other words, the actual measurement. Thus, the
term K is defined with the variance of this actual measurement and
the variance of the a priori information (in this case the previous
measurement, at the end of this section, the concept is further
clarified).
Finally, noticing from equation 2.2 that zt1 = xt1 and substituting
term K (2.8) in 2.7, this last equation can be rewritten as
2.2.1.3.
xt2 = xt1 +Kt2 [zt2 − xt1 ] (2.9)
The form shown in equation is actually the used form in KF
implementations. Furthermore, equations 2.2.1.3 and 2.8, show that
the optimal estimate at time t2, xt2 , is equivalent to the best
prediction of its value before zt2 is taken, xt1 , plus the
difference between zt2 and the best prediction of its value it is
actually taken xt1 , corrected with a term of optimal weighting
Kt2
[34].
Figure 2.8.: Propagation of conditional probability density
[34]
It is worthwhile to understand this “predictor-corrector” structure
of the filter (That is ex- plained in detail in section 2.2.1.6).
Based on all previous information, a prediction of the value that
the desired variables and measurement will have at the next
measurement time is made. Then, when the next measurement is taken,
the difference between this measurement and its predicted value is
used to “correct” the prediction of the desired variables.
Using the Kt2 in 2.8, the variance equation given by 2.5 can be
rewritten as the follows:
σ2xt2 = σ2xt1
(2.10)
Note that the values xt2 and σ2xt1 incorporate all the information
in fxt2 |zt1 ,zt2 (x|z1, z2). Stated
differently, by propagating these two variables, the conditional
density of the searched location x at time t2, given zt1 and zt2 ,
is completely specified.
The outlined equations solve the static estimation problem. Now,
the incorporation of dynam- ics into the problem can be considered.
It can be supposed that the object is moving forward in one
direction while the system try to estimate its position. It can be
assumed that a good model to describe this movement can be:
dx
dt = u+ w (2.11)
where u is a nominal velocity and w is a noise term used to
represent the uncertainty in the knowledge of the object’s velocity
due to disturbances, offnominal conditions, effects not accounted
for in the simple first order equation, and other similar effects.
The “noise” w is modeled as a white Gaussian noise with a mean of
zero and variance of σ2w.
As the object is moving, the density travels along the x axis at
the nominal speed u, while simultaneously spreading out about its
mean. This is due to the fact that as time progress the uncertainty
about the position of the object increases too. The probability
density starts at the best estimate, but in a dynamic system it
moves and spreads out in time. This represents the insecurity of
object’s exact position due to the constant addition of uncertainty
over time [34].
Just before the measurement is taken at time t3 (noted like x−t3 ,
“super minus” is going to be always used for a priori data) the
density fxt3 |zt1 ,zt2 (x|z1, z2) is as shown in fig. 2.8. It can
be expressed mathematically as a Gaussian density described by the
following mean and variance:
x−t3 = xt2 + u(t3 − t2) (2.12)
σ2 x− t3
Final Project - Marcos Cruz Santiago 12
CHAPTER 2. STATE OF THE ART
Thus, x−t3 is the optimal prediction of value of x at time instant
t−3 . In other words, before the measurement is taken at t3. The
expected variance of that prediction is σ2
x− t3
.
Now a measurement is taken, and its value turns out to be zt3 . Its
variance is assumed to be σ2zt3
. Similarly to the static case, there are now two Gaussian
densities available that contain information about position: one
encompassing all the information available before the measurement,
and the other being the information provided by the new observation
measurement zt3 . By the same process as before, the density with
mean x−t3 and variance σ2
x− t3
is combined
with the density mean zt3 and variance σ2zt3 to yield a Gaussian
density with mean:
xt3 = x−t3 +Kt3(zt3 − x−t3) (2.14)
and variance:
σ2xt3 = σ2
x− t3
(2.15)
Note that the definition of the gain K is done again taking into
consideration the last available measurement with the previous
information and it is defined as:
Kt3 = σ2 x− t3
+ σ2zt3 (2.16)
The optimal estimate, xt3 , satisfies the same form of equation as
previously seen in 2.2.1.3. The difference between zt3 and the best
prediction of xt3 before zt3 is corrected by an optimal weighting
value. Similarly, the variance and gain equations are of the same
form as 2.8 and 2.10.
It can be observed in the equations, that, if σzt3 , the
measurement noise variance, is large, then Kt3 is small; this says
little confidence is put in a very noisy measurement by weightening
it lightly. In the limit as σzt3 → ∞, Kt3 becomes zero, and xt3
equals x−t3 , an infinitely noisy measurement is totally ignored.
If the dynamic system noise variance σ2w is large, then σ2
x− t3
will
be large (see equation 2.13) and so will Kt3 , in this case,
certainty of the output of the system model within the filter
structure is very low and therefore would weight the measurement
heavily. Note that in the limit as σw →∞, σ2
x− t3
xt3 = x−t3 + 1(zt3 − x−t3) = zt3 (2.17)
Thus in the limit of absolutely no confidence in the system model
output, the optimal policy is to ignore the output and use the new
measurement as the optimal estimate. Finally, if σ2
x− t3
should ever become zero, then so does Kt3 this is sensible since if
σ2 x− t3
= 0, you are absolutely
sure of your estimate before zt3 becomes available. To sum up, in
this section it has been demonstrated the reasonableness of the
filter structure
that is derived mathematically in further sections.
2.2.1.4. Underlying dynamic system model
As it has been introduced, KF addresses the general problem of
estimating the hidden system state x ∈ Rn of a discrete-time
controlled process that is described by a linear stochastic differ-
ence equation. In other words, KF is based on a linear dynamic
system discretized in the time domain.
A discretized linear system can be represented as in fig. 2.9, and
its evolution expressed in a state space[41] like in equation
2.18.
Final Project - Marcos Cruz Santiago 13
CHAPTER 2. STATE OF THE ART
B DT H
zk = Hxk + vk (2.19)
Being xk the system state, uk ∈ Rm is the known input vector and zk
∈ Rm the observed measurements or the output of the system. In
other words, in a direct way it is only possible to observe the
value of zk, but this measure includes some associated uncertainty.
Therefore, in case of requiring the complete evolution of xk is
required to estimate that value.
The random variables, wk and vk, describe the stochastic process
associated to the measure and to the system, respectively. The
statistics of this random variables are assumed as eq. 2.20 and eq.
2.21 respectively. In addition they are independent of each other,
white, and with Gaussian probability distributions.
p(w) ∼ N(0,Q) (2.20)
p(v) ∼ N(0,R) (2.21)
In practice, the process noise covariance Q and measurement noise
covariance R matrices can change with each time step or
measurement. Nevertheless, they are assumed to be constant. In
addition, covariance matrices Q and R are considered diagonal and
therefore symmetric.
The n x n matrix A in the difference equation 2.18 describes the
state at the previous time step k−1 to the state at the actual step
k, in the absence of either a driving function or process noise5.
The n x l matrix B relates the optional control input u ∈ Rl to the
state x. The m x n matrix H in the measurement equation 2.19
relates the state to the measurement zk
6. To sum up, these matrices define the system dynamics [66].
2.2.1.5. The Computational Origins of the Filter
x−k ∈ Rn is defined to be a priori state estimate at step k,
carrying information of the previous process until step k. xk ∈ Rn
to be a posteriori state estimate at step k measurement zk. KF
searches for this estimated value by reducing a criterion. This
criterion, is an error, that should be minimized. Two different
errors can be defined: a priori (equation 2.22) and a posteriori
(equation 2.23) estimate errors.
5In practice A might change with each time step, but here it is
assumed to be constant. 6In practice C might also change with each
time step, but here it is assumed to be constant.
Final Project - Marcos Cruz Santiago 14
CHAPTER 2. STATE OF THE ART
Su p
p lie
d b
y u
se r
O b
se rv
ed H
id d
Xk-1,Pk-1
...
...
Figure 2.10.: Model underlying the Kalman filter. Squares symbolize
matrices. Ellipses sym- bolize multivariate normal distributions
(with the mean and covariance matrix enclosed). Values outside
shapes are vectors. In the simplier case, the various ma- trices
are constant with time, and thus the subscripts are dropped, but
the Kalman filter allows any of them to change each time step.
Modified from [2].
e−k = xk − x−k (2.22)
ek = xk − xk (2.23)
The a priori estimate error covariance and the a posteriori
estimate is then:
P−k = E{e−k e −T k } (2.24)
P k = E{ekeTk } (2.25)
Error covariance matrices are of special relevance in the KF
algorithm as they are used between all KF cycles, as it is depicted
in fig. 2.10.
To derive the equations for the KF, it is necessary to begin with
the goal of finding an expression that computes an a posteriori
state estimate xk as a linear combination of an a priori estimate
x−k and a weighted difference between an actual measurement zk and
a measurement prediction Hxk as shown in equation 2.26. Note that
in section 2.2.1.3 the justification of the following equation is
contained.
xk = x−k + K(zk −Hx−k ) (2.26)
The difference (zk −Hx−k ) in equation 2.26 is called measurement
innovation, or residual. The residual relates the discrepancy
between the predicted observed measurement (Hx−k )7 and the actual
measurement (zk). A residual of zero means that the two are in
complete agreement.
The n x m matrix K in 2.26 is chosen to be the gain or blending
factor that minimizes the a posteriori error covariance equation
2.25.
To find the value of the system state, the following equation can
be considered:
7Note that x−k is the predicted system state, to build the
predicted measurement the information of the obser- vation model,
H, should be used too.
Final Project - Marcos Cruz Santiago 15
CHAPTER 2. STATE OF THE ART
xk = x−k + Kk[zk −Hx−k )] Correctionfactor
(2.27)
Where zk is the last observed value, and x−k is the most updated
available value from the state (calculated on further section
2.2.1.6). As the goal of any filter is to minimize an error in some
sense, the proper value of Kk to achieve an optimal value of xk is
required such that the covariance matrix of error becomes minimal.
For this purpose the error from equation 2.23 can be redefined, by
substituting equation 2.27 into equation 2.23:
ek = xk − x−k −Kk(zk −Hx−k ) (2.28)
Now, the value of zk (equation 2.19), being it the output of the
system, should be considered. Therefore, by substitution:
ek = xk − x−k −KkHxk −Kkvk + KHx−k (2.29)
Grouping terms, and using the a posteriori error covariance form in
equation 2.25:
P k = E{(I −KkH)(xk − x−k )−Kkvk(I −KkH)(xk − x−k )−KkvkT }
(2.30)
Operating over the last equation:
P k = E{(I −KkH)(xk − x−k )(I −KkH)(xk − x−k )T }+ E{Kkvkv T k
K
T k } (2.31)
From equation 2.21, it is known that as E{vkvTk } is Rk, the
covariance matrix associated to the measurements. So, substituting
this value and operating the deterministic values over the
expectation value:
P k = (I −KkH)E{(xk − x−k )(xk − x−k )T }(I −KkH)T + KkRkK T k
(2.32)
Taking into account equation 2.24 and by substitution, it
results:
P k = (I −KkH)P−k (I −KkH)T + KkRkK T k (2.33)
Operating over the previous sentence:
P k = P−k − P−k H TKT
k −KkHP−k + KkHP−k H TKT
k + KkRkK T k (2.34)
This minimization can be accomplished taking the derivative of the
trace of the whole equation, setting result equal to zero, and then
solving for Kk [66].
Therefore, the trace operator (Tr : Trace of the matrix8) it is
applied to equation 2.34:
Tr{P k} = Tr{P−k } − 2Tr{P−k H TKT
k } −+Tr{KkHP−k H TKT
k }+ Tr{KkRkK T k } (2.35)
As said before, to found the minimum, equation 2.35 has to be
differentiated and its result set zero.
∂Tr{P k} ∂Kk
= −2Tr{P− k HT
k }+ 2Tr{KkHP−k H T }+ 2Tr{KkRk} = 0 (2.36)
8In linear algebra, the trace of an n x n square matrix M is
defined to be the sum of the elements on the main diagonal (the
diagonal from the upper left to the lower right).
Final Project - Marcos Cruz Santiago 16
CHAPTER 2. STATE OF THE ART
Finally, the resulting Kk that minimizes the a posteriori estimate
error covariance P k 9 is:
Kk = P−k H T (HP−k H
T + R)−1 = P−k H
T
(2.37)
It can be proved that K is the minimum by using the Hessian, by
making a substitution of equation 2.37 in equation 2.33.
On the one hand, looking at equation 2.37, it can be seen that as
the measurement error covariance R approaches zero, the gain K
weights the residual more heavily. Specifically:
lim Rk→0
Kk = H−1 (2.38)
On the other hand, as the a priori estimate error covariance P−k
approaches zero, the gain K weights the residual less heavily.
Specifically:
lim P−
k→0 Kk = 0 (2.39)
Another way of understanding the weighting by K is that as the
measurement error covariance R approaches zero, the actual
measurement zk trust grows, while the predicted measurement Hx−k
trust decreases. Moreover, as the a priori estimate error
covariance P−k approaches zero the actual measurement zk is trusted
less and less while predicted measurement Hx−k is trusted more and
more.
2.2.1.6. The Discrete Kalman Filter Algorithm
In this section, a high-level operation scheme of one form of the
discrete KF is covered. After presenting this high-level view,
specific equations of the filter and their use is given.
KF estimates a process by using cyclically a form of feedback
control: first, the filter estimates the process state at some time
step by using its inner parameters (model, covariance matrices and
the past estimate) and after it obtains feedback by using the
observed measurements. As such, the equations for the KF fall into
two groups: time update and measurement update equations.
Therefore, it can be concluded, that the KF algorithm has two steps
that are executed in an iterative way [66]:
• Time update: This step is responsible for projecting forward (to
the next time step) the current state and error covariance
estimates in order to obtain the a priori estimates for the next
time step.
• Measurement update: This part of the algorithm is responsible for
the feedback. In this step the new measurement information is
incorporated into the a priori estimate to obtain an improved a
posteriori estimate.
The time update equations can also be thought of as predictor
equations, while the measure- ment update equations can be thought
of as corrector equations [66]. Indeed the final estimation
algorithm resembles that of a predictor-corrector algorithm for
solving numerical problems, as is depicted in 2.11.
9All of the Kalman filter equations can be algebraically
manipulated into to several forms, here it is showed one of the
most used forms.
Final Project - Marcos Cruz Santiago 17
CHAPTER 2. STATE OF THE ART
Time Update (Predict)
Measurement Update (Correct)
Figure 2.11.: The ongoing discrete Kalman filter cycle. The time
update projects the current state estimate ahead in time. The
measurement update adjusts the projected esti- mate with the actual
measurement.
Step 1 : Time Update / Prediction The objective of this step is
twofold:
1. Predict the current state x−k .
2. Predict the estimate error covariance matrix P−k .
On the one hand, this step compromises the prediction of xk, named
x−k . The predicted value is calculated from the most current value
of the state (later it is seen that it is the corrected state from
the final part of the algorithm). See equation 2.40, note that A
and B are from equation 2.18.
x−k = Axk−1 + Buk−1 (2.40)
On the other hand, the algorithm has to predict the value of the
covariance matrix P−k of the previous error to the measurement. In
the following lines it is revised how to reach mathematically the
appropriate equation that is executed by KF algorithm to make this
measure.
To find the right expression for prediction stage in KF algorithm
the definition of e−k from equation 2.23 and the definition of the
covariance matrix P−k from equation 2.22 is used. By substituting
2.40 in both, they can be expressed as:
e−k = Axk−1 + Buk−1 + wk−1 − Axk−1 Buk
(2.41)
P−k = E{[A(xk−1 − xk−1) + wk−1][A(xk−1 − xk−1 + wk−1)] T }
(2.42)
By just operating:
P−k = E{[A(xk−1 − xk−1)][A(xk−1 − xk−1]T }+ E{wk−1w T k−1}
(2.43)
E{wk−1w T k−1} it is defined as the covariance matrix associated to
the process: Q, seen before
in equation 2.20. Therefore, finally:
P−k = AP k−1A T + Q (2.44)
Being equation 2.40 with equation 2.44 the practical time update
equations used in KF im- plementations. Notice how these equations
refresh the state and covariance estimates from time step k − 1 to
step k.
Final Project - Marcos Cruz Santiago 18
CHAPTER 2. STATE OF THE ART
Step 2 : Measurement Update / Correction This part of the KF
algorithm has three main goals:
1. Compute the Kalman gain Kk.
2. Update the estimate state with the measurement zk.
3. Update the error covariance P k.
As in the previous section it is given some mathematical
manipulations to achieve the proper equations used on KF
implementations.
As it had been said in the previous section 2.2.1.6 the value of
the state is going to be calculated using the previous state and a
correction that is in function of the error.
The first task during the measurement update is to compute the
Kalman gain Kk. Notice that in previous sections we have justified
the form of Kalman gain. So to compute the Kalman gain, KF
algorithms use equation 2.37.
The next step is to actually measure the process to obtain zk, and
then to generate a priori state estimate by incorporating the
measurement. This step could be achieved by using equation 2.26,
justified in previous sections.
The final step is to obtain an a posteriori error covariance
estimate. So substituting equation 2.37 into equation 2.33, the
following equation it is obtained:
P k = [1−KkH]P−k (2.45)
To sum up, the whole algorithm, after each time and measurement
update step, the process is repeated cyclically but with the
previous a posteriori estimates. This recursive processing scheme
is one of the most interesting features of the KF (it make a
practical implementations much more feasible than for instance an
implementation of a Wiener filter which operates on all of the data
directly for each estimate [7]). The KF instead recursively
conditions the current estimate on all of the past observation
measurements. Fig. 2.12 depicts the operation of the filter,
merging the high-level diagram of fig. 2.11 with the equations
showed in this section. Equations that in fact are the basis of any
KF algorithm.
2.2.1.7. Filter Parameters and Tuning
To initiate the algorithm it is necessary to know the following
boundary conditions: An initial value of the state: x0, and the
value of the error covariance matrix, P 0. It can be assumed that P
0 = Q, in fact, usually it can be chosen almost any P 0 6= 0 and
the filter will eventually converge (see fig. 2.13). In addition,
the values of the covariance matrices associated to the system and
the measurement (Q and R) are needed.
The measurement noise covariance R is usually measured before the
filter starts working. To find out the measurement error covariance
R is generally possible because it is needed to be capable to
measure the process anyway (while operation the filter) so it
should generally possible to take some offline sample measurements
in order to estimate the variance of the measurement noise. R’s
choice becomes a very important part of the filter tuning. If the
“true” measurement error
variance is chosen, it is expected the “best” performance in terms
of balancing responsiveness and estimate variance (see fig. 2.14)
[34].
However, when the value of R is very different from the “true”
measurement error variance, the filter has a worse performance. In
the case that a R higher than the error variance is used, the
filter use to be “slower” to believe the measurements (see fig.
2.15) and in the case that
Final Project - Marcos Cruz Santiago 19
CHAPTER 2. STATE OF THE ART
Kk Pk - HT HPk
xk 1–Initial estimates for and Pk 1–
xk xk -
(3) Update the error covariance
Pk I KkH–( )Pk -
(2) Project the error covariance ahead
Time Update (“Predict”)
APk 1– AT Q+=
Figure 2.12.: A complete picture of the operation of the Kalman
filter [66]
0 20 40 60 80 100 120 140 160 0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
Iterations (n)
E r r o r c o v a r i a n c e v a l u e
Figure 2.13.: Example of error covariance P−k vs iterations in a
tryout to estimate a scalar random value (in this case the scalar
was 30). As it can be seen the value converge quickly.
Final Project - Marcos Cruz Santiago 20
CHAPTER 2. STATE OF THE ART
0 20 40 60 80 100 120 140 160 25
26
27
28
29
30
31
32
v a l u e
Number of iterations (n)
Figure 2.14.: Simulation of an estimation of a constant value
corrupted by noise. Being the blue line the estimation, the red
line the real value, and the green line the noisy measurement of
the constant. The graphic show iterations (x axis) vs value (y
axis). It has been used R equal to the true measurement error
variance.
the measurement variance R is much smaller than its optimal value,
the filter tend to be very “quick” to believe noisy measurements
(See fig. 2.16).
In case of process noise covariance Q the determination of it, is
generally more difficult as it is typically not able to be observed
directly the process that is being estimated. Sometimes a simple
process model can generate acceptable results if it is “injected”
sufficient uncertainty into the process via the selection of Q
[34].
In either case, whether or not if it is given a rational basis for
choosing the parameters, often times superior filter performance
(in a statistical way) can be obtained by tuning the filter
parameters Q and R. This tuning is usually done off-line,
frequently by means of a distinct KF in a process generally
referred to as system identification.
Under conditions where Q and R are in fact constant. Furthermore,
both the estimation error covariance P k and Kalman gain Kk will
stabilize rapidly and then remain constant. If this is the case
these parameters can be previously computed by either running the
filter off-line or for instance by determining the steady-state
value of P k [18].
2.2.2. Extended Kalman Filter
As described in section 2.2, the main goal of KF is to estimate the
state x ∈ Rn of a discrete-time controlled process that is
described by a linear stochastic difference equation.
Unfortunately, in practice most of the interesting systems tend to
be nonlinear. Nevertheless, some of the most interesting and
notable applications of Kalman filtering have been such situations
[66].
In order to extend the KF to nonlinear systems, a modified version
of it, known as the Extended Kalman Filter (EKF) was developed. Due
to the issue of nonlinearity, the EKF is no longer an optimal
filter in the MMSE sense as it was the KF, but in practice it has
been proved
Final Project - Marcos Cruz Santiago 21
CHAPTER 2. STATE OF THE ART
0 20 40 60 80 100 120 140 160 25
26
27
28
29
30
31
32
E s t i m a t e d v a l u e
Number of iterations (n)
Figure 2.15.: Simulation of an estimation of a constant value
corrupted by noise. Being the blue line the estimation, the red
line the real value, and the green line the noisy measurement of
the constant. The graphic show iterations (x axis) vs value (y
axis). It has been used R equal to 1. The filter is slower to react
to the measurements, resulting in reduced estimate variance.
to be a truly powerful adaptive filter [21].
2.2.2.1. The Process to be Estimated
In something similar to a Taylor series, the estimation can be
linearized around the current estimate using the partial
derivatives of the process and the measurement functions to
calculate estimates even in the face of non-linear relationships
[66].
Therefore EKF can be formulated in the following way: consider a
discrete-time nonlinear system with the unobserved underlying state
vector xk ∈ Rn and observation vector (or mea- surement) zk ∈ Rn at
time instant k. A dynamic model of this system may be represented
as follows [19]:
xk = f(xk−1, uk−1, wk−1) (2.46)
zk = h(xk, vk) (2.47)
Where f(·) describes the non-linear function of the state evolution
and describes the state at the previous time step k−1 to the state
at the current time step k. h(·) embody the relationship between
the state vector and the observations. The process and measurement
noise vectors are the random variables wk and vk respectively, with
the following associated covariance matrices Qk = E{wkw
T k } and Rk = E{vkvTk }. Notice that, as like in KF, xk is the
actual state vector (the
quantity that is going to be estimated) and is not possible to
measure it directly. Nevertheless, it is possible to access to the
actual measurement zk, that is going to be used to estimate
xk.
Final Project - Marcos Cruz Santiago 22
CHAPTER 2. STATE OF THE ART
0 20 40 60 80 100 120 140 160 25
26
27
28
29
30
31
32
E s t i m a t e d v a l u e
Number of iterations (n)
Figure 2.16.: Simulation with a KF of an estimation of a constant
value corrupted by noise. Being the blue line the estimation, the
red line the real value, and the green line the noisy measurement
of the constant. The graphic show iterations (x axis) vs value (y
axis). It has been used R equal to 0.0001. The filter responds to
measurements rapidly, increasing the estimate variance.
In practice it is not possible to know the individual values of the
noise wk and vk at each time step. However, the state and
measurement vector can be approximated without them as:
xk = f(xk−1, uk−1, 0) (2.48)
zk = h(xk, 0) (2.49)
where xk−1 is some a posteriori estimate of the state (from a
previous time step k). It is important to note that a main drawback
of the EKF is that the distributions of the
various random variables are not anymore normal after applying the
respective nonlinear trans- formations [66]. The EFK is just an
adhoc state estimator that only approximates the optimality of
Bayes’ rule by linearization [34]. However, some interesting works
have been done to preserve the normal distributions of the random
variables in non-linear KF’s [22].
2.2.2.2. The Computational Origins of the Filter
In order to use a KF formalism to estimate a process with
non-linear difference and measure relationship, it is mandatory to
derive a linear approximation of equations 2.46 and 2.47. This
brings the following linear approximate model:
xk ≈ xk + Ak(xk−1 − xk−1) + W kwk−1 (2.50)
zk ≈ zk + Hk(xk − xk) + V kvk (2.51)
Final Project - Marcos Cruz Santiago 23
CHAPTER 2. STATE OF THE ART
where:
• xk and zk are the actual state and measurement vectors,
• xk and zk are the approximate state and measurement vectors from
equations 2.48 and 2.49,
• xk is a posteriori estimate of the state at step k,
• the random variables wk and vk represent the process and
measurement noise,
• Ak is the Jacobian matrix of partial derivatives of f with
respect to x, that is
Ak[i,j] = ∂f[i]
∂x[j] (xk−1, uk−1, 0)
• W k is the Jacobian matrix of partial derivatives of f with
respect to w,
W k[i,j] = ∂f[i]
∂w[j] (xk−1, uk−1, 0)
• Hk is the Jacobian matrix of partial derivatives of h with
respect to x,
Hk[i,j] = ∂h[i]
∂x[j] (xk, 0)
• V k is the Jacobian matrix of partial derivatives of h with
respect to v,
V k[i,j] = ∂h[i]
∂v[j] (xk, 0)
Note that in the definitions of Jacobians Ak, W k, Hk and V k is
used the time step subscript k. The reason is because they are
different at each time step. Hence they must be recomputed for each
k. Following, there is necessity to define a new nomenclature for
the prediction error and the measurement residual:
exk ≡ xk − xk (2.52)
ezk ≡ zk − zk (2.53)
Error process equation can be rewritten, by substituting equation
2.50 in equation 2.52 and substituting equation 2.51 in equation
2.53:
exk ≈ Ak(xk−1 − xk−1) + εk (2.54)
ezk ≈Hkexk + ηk (2.55)
where εk and ηk relate new independent random variables. They have
zero mean and covari- ance matrices W kQkW
T k and V kRkV
T k , with Qk and Rk as in equation 2.20 and equation 2.21
respectively. Notice that equation 2.54 and equation 2.55 are
linear, and that they are very similar to the
measurement equations 2.18 and 2.19 from the discrete KF.
Final Project - Marcos Cruz Santiago 24
CHAPTER 2. STATE OF THE ART
This motivates the use of the actual measurement residual ezk in
equation 2.53 and a second (hypothetical) KF to estimate the
prediction error exk
given by equation 2.54. Therefore, ek could then be used along with
equation 2.52 to obtain the a posteriori state estimates for the
original non-linear process as [34]:
x = xk + ek (2.56)
The random variables from equations 2.54 and 2.55 have
approximately the following proba- bility distributions:
p(exk ) ∼ N(0, E(exk
p(εk) ∼ N(0,W kQkW T k ) (2.58)
p(ηk) ∼ N(0,V kRkV T k ) (2.59)
Given this approximations and letting the predicted value of ek be
zero, the KF equation to estimate ek is:
ek = Kkezk (2.60)
By substituting equation 2.60 back into equation 2.56 and making
use of equation 2.53 it can be seen that there is no need of a
second (hypothetical) KF:
xk = xk + Kkezk = xk + Kk(zk − zk) (2.61)
Equation 2.61 can be used for the measurement update step in the
EKF, with xk and zk coming from equations 2.48 and 2.49, and the
Kalman Gain Kk coming from equation 2.37with the suitable
substitution for the measurement error covariance .
2.2.2.3. The Discrete Extended Kalman Filter Algorithm
The EKF algorithm is similar to the KF algorithm, so in this
section a review of the filter algorithm is done emphasizing the
differences between KF and EKF is given (for more details on the
algorithm see section 2.2.1.6, where the KF algorithm is more
detailed). Fig. 2.17 offers a complete scheme of the operation of
the EKF with the complete set of EKF equations needed for the
implementation algorithm.
Note that xk has been substituted for x−k to remain consistent with
the previous “super minus” a priori notation. The reason for not
doing it before is to introduce in a somehow intuitive manner the
construction of EKF, however in this section the formal equations
used by the EKF are described, so a formal notation must be
used.
As with the basic discrete KF, the time update equations in fig.
2.17 update the state and covariance estimates from the previous
time step k− 1 to the current time step k and measure- ment update
equations correct the system state and covariance estimates with
the measurement zk.
An important benefit of the EKF algorithm is that the Jacobian Hk
in the equation for the Kalman gain Kk serves to correctly
propagate or “magnify” only relevant components of the measurement
information. For instance, if there is not a one-to-one mapping
between the measurement zk and the state via h, the Jacobian H
affects the Kalman gain so that it only magnifies the portion of
the residual zk − h(x−k , 0) that does affect the state [66].
Indeed if over all measurements there is not a one-to-one mapping
between the measurement zk and the
Final Project - Marcos Cruz Santiago 25
CHAPTER 2. STATE OF THE ART
Welch & Bishop, An Introduction to the Kalman Filter 11
UNC-Chapel Hill, TR 95-041, July 24, 2006
Figure 2-1. A complete picture of the operation