Sunday 21 October 2007

Sensor Noise (I)


Sensory data is usually noisy unless the sensor itself has a decent built-in filter. However, we can write simple filters to filter out noise. Matlab provides decent filter function, for instance, "filtfilt" for this purpose. I have written a simple filtfilt function working with C or C++ applications, shown in the figure.

Order is the order of the filter function, i.e. zero, first, second, etc. Based on the order coefficients, "a" and "b" are calculated. The simplest way to calculate them is using Matlab "butter" function
, e.g., [b,a]=butter(order, length); For a third order filter coefficients, "a" and "b" are calculated as: [b,a] = butter(3,1/10);

b[0]= 0.0007; b[1]= 0.0021; b[2]=0.0021;
b[3]=0.0007; a[0]= 1.0000; a[1]= -2.6236;
a[2]= 2.3147; a[3]=-0.6855;

No comments: