DSPRelated.com
Forums

Kalman Filter applied to Rangefinding Data

Started by jcarter January 22, 2010
I must be missing something.  I passed 128 records of 1300 samples each
(1300x128) through a Kalman Filter (This is basically a laser return signal
- often times quite small- buried in solar noise generated by an APD -
Avalanche Photo Diode) and the output appears as noisy as any one of the
record inputs.  Simple Averaging of these 128 records yields a signal from
the noise, but I was under the impression that Kalman Filter is superior to
simple averaging for lifting signal from noise.  I can only conclude that I
am doing something wrong.  I had set my State Transition Matrix (A) and
Observation Matrix (H) to an Identity Matrix, and I played around with
process noise covariance(Q) and measurement noise covariance (R) values but
to no avail.  This is a stationary process so I employed a Simple Discrete
Kalman Filter.  Are there any limitations to the use of Kalman filters? 
Sampling Rates?  Any suggestions why a filter may fail you?  Thanks.




jcarter wrote:

> I must be missing something. I passed 128 records of 1300 samples each > (1300x128) through a Kalman Filter (This is basically a laser return signal > - often times quite small- buried in solar noise generated by an APD - > Avalanche Photo Diode) and the output appears as noisy as any one of the > record inputs. Simple Averaging of these 128 records yields a signal from > the noise, but I was under the impression that Kalman Filter is superior to > simple averaging for lifting signal from noise. I can only conclude that I > am doing something wrong. I had set my State Transition Matrix (A) and > Observation Matrix (H) to an Identity Matrix, and I played around with > process noise covariance(Q) and measurement noise covariance (R) values but > to no avail. This is a stationary process so I employed a Simple Discrete > Kalman Filter. Are there any limitations to the use of Kalman filters? > Sampling Rates? Any suggestions why a filter may fail you? Thanks.
What makes you think that Kalman filter should perform any better then simple averaging in your case? FWIW, Kalman filter theory covers more general situation; i.e. if your target moves with known dynamics, if the noise is not white, etc. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
On Jan 23, 6:55&#4294967295;am, "jcarter" <jcar...@leupold.com> wrote:
> I must be missing something. &#4294967295;I passed 128 records of 1300 samples each > (1300x128) through a Kalman Filter (This is basically a laser return signal > - often times quite small- buried in solar noise generated by an APD - > Avalanche Photo Diode) and the output appears as noisy as any one of the > record inputs. &#4294967295;Simple Averaging of these 128 records yields a signal from > the noise, but I was under the impression that Kalman Filter is superior to > simple averaging for lifting signal from noise. &#4294967295;I can only conclude that I > am doing something wrong. &#4294967295;I had set my State Transition Matrix (A) and > Observation Matrix (H) to an Identity Matrix, and I played around with > process noise covariance(Q) and measurement noise covariance (R) values but > to no avail. &#4294967295;This is a stationary process so I employed a Simple Discrete > Kalman Filter. &#4294967295;Are there any limitations to the use of Kalman filters? > Sampling Rates? &#4294967295;Any suggestions why a filter may fail you? &#4294967295;Thanks.
You have probably implmented a steady-state Kalman filter or Wiener state estimator. Hardy
On Fri, 22 Jan 2010 12:11:46 -0600, Vladimir Vassilevsky wrote:

> jcarter wrote: > >> I must be missing something. I passed 128 records of 1300 samples each >> (1300x128) through a Kalman Filter (This is basically a laser return >> signal - often times quite small- buried in solar noise generated by an >> APD - Avalanche Photo Diode) and the output appears as noisy as any one >> of the record inputs. Simple Averaging of these 128 records yields a >> signal from the noise, but I was under the impression that Kalman >> Filter is superior to simple averaging for lifting signal from noise. >> I can only conclude that I am doing something wrong. I had set my >> State Transition Matrix (A) and Observation Matrix (H) to an Identity >> Matrix, and I played around with process noise covariance(Q) and >> measurement noise covariance (R) values but to no avail. This is a >> stationary process so I employed a Simple Discrete Kalman Filter. Are >> there any limitations to the use of Kalman filters? Sampling Rates? >> Any suggestions why a filter may fail you? Thanks. > > What makes you think that Kalman filter should perform any better then > simple averaging in your case? FWIW, Kalman filter theory covers more > general situation; i.e. if your target moves with known dynamics, if the > noise is not white, etc.
For that matter, what makes you think that a Kalman filter for your set of assumptions isn't a simple averaging filter? A pure Kalman (not extended, or unscented, or whatever) is just a garden- variety time-varying (maybe) state-space filter that happens to have been designed using a particular method. "Kalman filter" does not mean "Magic filter". -- www.wescottdesign.com
On Jan 23, 5:29&#4294967295;pm, Tim Wescott <t...@seemywebsite.com> wrote:

 &#4294967295;"Kalman filter" does not mean "Magic
> filter". >
It doesn't? Shit man what do I do now? Next thing you will be telling me PID is as good as optimal control.. Hardy
On Fri, 22 Jan 2010 21:34:40 -0800, HardySpicer wrote:

> On Jan 23, 5:29&nbsp;pm, Tim Wescott <t...@seemywebsite.com> wrote: > > &nbsp;"Kalman filter" does not mean "Magic >> filter". >> > It doesn't? Shit man what do I do now? Next thing you will be telling me > PID is as good as optimal control.. > > > Hardy
Model a plant as a first-order lowpass, with an unknown and constant offset. Then model that unknown and constant offset as an uncontrolled integrator. Now find the optimal linear controller in the least-squares sense. Voile! A PID. So in this case a PID isn't just "as good as", it _is_ the optimal controller. -- www.wescottdesign.com
On Fri, 22 Jan 2010 11:55:31 -0600, jcarter wrote:

> I must be missing something. I passed 128 records of 1300 samples each > (1300x128) through a Kalman Filter (This is basically a laser return > signal - often times quite small- buried in solar noise generated by an > APD - Avalanche Photo Diode) and the output appears as noisy as any one > of the record inputs. Simple Averaging of these 128 records yields a > signal from the noise, but I was under the impression that Kalman Filter > is superior to simple averaging for lifting signal from noise.
Possibly, but that depends. For the right problem (a constant signal, and uncorrelated white noise), the matching Kalman filter _is_ a simple averaging filter.
> I can only conclude that I am doing something wrong. I had set my State > Transition Matrix (A) and Observation Matrix (H) to an Identity Matrix, > and I played around with process noise covariance(Q) and measurement > noise covariance (R) values but to no avail.
You need to model the expected signal as a generating system, then use that generating system to calculate your filter.
> This is a stationary > process so I employed a Simple Discrete Kalman Filter. Are there any > limitations to the use of Kalman filters?
Yes.
> Sampling Rates?
Yes.
> Any suggestions why a filter may fail you? Thanks.
Whomping up a Kalman filter from a model that is a poor match to the reality is certainly a way. A Kalman filter is just a linear filter -- possibly time varying -- that has been designed with a specific technique to make it optimal according to a set of criteria chosen to make computation tractable. If the performance you need is not well represented by the optimality criteria that Kalman chose to make the math come out right, or if your system model doesn't match reality, then your filter may waste time and processor resources, but it won't necessarily make detection better. If I read your post correctly you're trying to design an optimal signal to extract a signal with known parameters from a return that is corrupted by noise. It sounds also like your procedure is to take 128 measurements, each yielding a vector of 1300 points. Because of the passage of time, it's pretty safe to assume that the nth point in any of these 128 vectors is uncorrelated with any other such point. So starting out by averaging those 128 vectors into one 1300 point vector is a very good step, and if it's sufficient, you can stop there. Doing time-domain filtering on each of the 1300 vectors may be to your advantage, but only if the laser return spans more than one sample. If this is the case, then rather than a Kalman filter you probably need a simple matched filter, whose output gets fed to a comparator with a varying threshold to account for any anticipated range vs. amplitude variation. -- www.wescottdesign.com
James,

Averaging several time-correlated observation vectors is a fundamental way of eliminating interfering noise. In your case, averaging 128 realizations (each with 1,300 samples) should drop the noise-level considerably.

With respect to your Kalman filter work, how did you apply Kleder's KALMANF Matlab function script-file?

The example included by Kleder's script-file considers a 1-dimensional state-vector or simple scalar case. This seems to be a solid way to introduce Kalman filter principals; see the article by Roger M. du Plessis, "Poor Man's Explanation of Kalman Filtering or How I Stopped Worrying and Learned to Love Matrix Inversion."

With respect to your case, the state transition matrix would not be unity or 1, this is because the echo-signal received by the sensor is not constant. It would be some time-dependent discrete function characterizing this behavior; I do not know what this would look like.

You should also note that there are important assumptions with respect to application of Kalman filtering. In basic cases, likely yours, the underlying noise processes (both process and measurement) are Gaussian in nature and the state-transition and measurement matrices are linear. With both of these assumptions met and having correct state transition and measurement matrices in place, the Kalman filter will operate as the optimal minimum mean-square estimator.

In more advanced cases, the associated noise processes are not Gaussian and system dynamics are not linear. Non-linear dynamics require linearization, thus the presence of the extended Kalman filter.


Michael. 

---
frmsrcurl: http://compgroups.net/comp.dsp/Kalman-Filter-applied-to-Rangefinding-Data