PRACTICAL GUIDE TO DATA SMOOTHING AND FILTERING



Similar documents
The Calculation of G rms

Time series analysis Matlab tutorial. Joachim Gross

Signal to Noise Instrumental Excel Assignment

SGN-1158 Introduction to Signal Processing Test. Solutions

Convolution, Correlation, & Fourier Transforms. James R. Graham 10/25/2005

Natural cubic splines

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

The continuous and discrete Fourier transforms

the points are called control points approximating curve

expression is written horizontally. The Last terms ((2)( 4)) because they are the last terms of the two polynomials. This is called the FOIL method.

The Effective Number of Bits (ENOB) of my R&S Digital Oscilloscope Technical Paper

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

1 Review of Least Squares Solutions to Overdetermined Systems

Chapter 8 - Power Density Spectrum

Cubic Functions: Global Analysis

How to Design 10 khz filter. (Using Butterworth filter design) Application notes. By Vadim Kim

Analog Filters. A common instrumentation filter application is the attenuation of high frequencies to avoid frequency aliasing in the sampled data.

November 16, Interpolation, Extrapolation & Polynomial Approximation

The degree of a polynomial function is equal to the highest exponent found on the independent variables.

NRZ Bandwidth - HF Cutoff vs. SNR

DIEF, Department of Engineering Enzo Ferrari University of Modena e Reggio Emilia Italy Online Trajectory Planning for robotic systems

Piecewise Cubic Splines

FREQUENCY CONTROLLED AC MOTOR DRIVE

MATRIX TECHNICAL NOTES

CHAPTER 6 Frequency Response, Bode Plots, and Resonance

Continued Fractions and the Euclidean Algorithm

chapter Introduction to Digital Signal Processing and Digital Filtering 1.1 Introduction 1.2 Historical Perspective

4.3 Lagrange Approximation

2008 AP Calculus AB Multiple Choice Exam

UNCORRECTED PAGE PROOFS

FAST Fourier Transform (FFT) and Digital Filtering Using LabVIEW

Frequency Response of Filters

Review of Fundamental Mathematics

INTERPOLATION. Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y).

2.161 Signal Processing: Continuous and Discrete Fall 2008

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

First, we show how to use known design specifications to determine filter order and 3dB cut-off

Polynomial and Rational Functions

1.3 Algebraic Expressions

(Refer Slide Time: 1:42)

Em bedded DSP : I ntroduction to Digital Filters

The Fourier Analysis Tool in Microsoft Excel

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

Machine Learning and Data Mining. Regression Problem. (adapted from) Prof. Alexander Ihler

Trend and Seasonal Components

Introduction to time series analysis

3. Interpolation. Closing the Gaps of Discretization... Beyond Polynomials

Lecture - 4 Diode Rectifier Circuits

Microeconomic Theory: Basic Math Concepts

Lagrange Interpolation is a method of fitting an equation to a set of points that functions well when there are few points given.

Introduction to Digital Audio

The Convolution Operation

Switch Mode Power Supply Topologies

Similar benefits are also derived through modal testing of other space structures.

ANALYTICAL METHODS FOR ENGINEERS

Sound absorption and acoustic surface impedance

ECG SIGNAL PROCESSING AND HEART RATE FREQUENCY DETECTION METHODS

Neural Network and Genetic Algorithm Based Trading Systems. Donn S. Fishbein, MD, PhD Neuroquant.com

The KaleidaGraph Guide to Curve Fitting

LABORATORY 10 TIME AVERAGES, RMS VALUES AND THE BRIDGE RECTIFIER. Bridge Rectifier

HYBRID FIR-IIR FILTERS By John F. Ehlers

X X X a) perfect linear correlation b) no correlation c) positive correlation (r = 1) (r = 0) (0 < r < 1)

Demand Forecasting When a product is produced for a market, the demand occurs in the future. The production planning cannot be accomplished unless

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Frequency Response of FIR Filters

Function Guide for the Fourier Transformation Package SPIRE-UOL-DOC

Analog Representations of Sound

is the degree of the polynomial and is the leading coefficient.

The D.C Power Supply

1995 Mixed-Signal Products SLAA013

SR2000 FREQUENCY MONITOR

DIGITAL-TO-ANALOGUE AND ANALOGUE-TO-DIGITAL CONVERSION

Transmission Line and Back Loaded Horn Physics

Precision Diode Rectifiers

Data Analysis with MATLAB The MathWorks, Inc. 1

PID Control. Chapter 10

Summary of important mathematical operations and formulas (from first tutorial):

Probability and Random Variables. Generation of random variables (r.v.)

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS

Voltage. Oscillator. Voltage. Oscillator

Introduction to IQ-demodulation of RF-data

Student Performance Q&A:

Fig. 1 :Block diagram symbol of the operational amplifier. Characteristics ideal op-amp real op-amp

Workshop Perceptual Effects of Filtering and Masking Introduction to Filtering and Masking

Auto-Tuning Using Fourier Coefficients

Section 5.0 : Horn Physics. By Martin J. King, 6/29/08 Copyright 2008 by Martin J. King. All Rights Reserved.

Analog and Digital Filters Anthony Garvert November 13, 2015

Building a Smooth Yield Curve. University of Chicago. Jeff Greco

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

LAB 12: ACTIVE FILTERS

Point Lattices in Computer Graphics and Visualization how signal processing may help computer graphics

Lecture 25 Design Example for a Channel Transition. I. Introduction

Statistics. Measurement. Scales of Measurement 7/18/2012

Microeconomics Sept. 16, 2010 NOTES ON CALCULUS AND UTILITY FUNCTIONS

Filter Comparison. Match #1: Analog vs. Digital Filters

TCOM 370 NOTES 99-4 BANDWIDTH, FREQUENCY RESPONSE, AND CAPACITY OF COMMUNICATION LINKS

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

Basic Acoustics and Acoustic Filters

Simple Harmonic Motion Experiment. 1 f

Transcription:

PRACTICAL GUIDE TO DATA SMOOTHING AND FILTERING Ton van den Bogert October 3, 996 Summary: This guide presents an overview of filtering methods and the software which is available in the HPL.. What is filtering/smoothing? Smoothing is an operation which removes high-frequency fluctuations from a signal. Low-pass filtering is another term for the same thing, but is restricted to methods which are linear: i.e. if you want to filter a signal x(t)+y(t), it does not matter whether you apply the filter before or after adding the two signals. Such linear operations can be described by a frequency response. All methods described here are linear, with the exception of curve fitting. 2. Why (low-pass) filtering? Random noise can greatly affect the result of certain types of analysis. Two important examples are: quantification of peaks in the signal (noise can shift the location of the peak, and leads to systematic overestimation of the height of the peak), and differentiation (noise is amplified by differentiation). Always consider filtering before these types of data analysis. Since random (or white ) noise is distributed over all frequencies, and signal is typically limited to low frequencies, a reduction of high frequency components will improve the signal/noise ratio. 3. Methods and software 3.. Analog (RC, resistor-capacitor) filter R input C output The frequency response is a st order Butterworthfilter, and really easy to make (< Stano-hour), cut-off frequency f 0 = --------------. Connect this between your signal source (transducer or amplifier) and the A/D converter if 2πRC you want to get rid of high frequencies before the signal is sampled. Remember the sampling theorem: if the signal contains frequencies which are higher than half the sampling frequency, you can get erroneous results. An analog filter is the only way to make sure that high frequencies don t reach the A/D converter.

The frequency response (defined as the ratio between input and output amplitude for a sine wave of frequency f) of an nth order Butterworth filter is: A out A in --------- H( f ) = ----------------------------- f + ----- 2n f 0 H(f) f 0 =50 Hz n= n=3 n=2 f [Hz} Higher order analog filters are much harder to make (> Stano-day). 3.2. Digital filters Digital filters are implemented as a computer program that transforms sampled data. E.g. 2nd order recursive filter: y i = ax i + bx i + cx i 2 + dy i + ey i 2 The term recursive means that past y-values are fed back to the input. The relationship between input samples ( x x n ) and output samples ( y y n ) is illustrated in the following diagram: 2

(only for recursive filter) x, x 2, x 3, FILTER y, y 2, y 3, KinTrak: Uses a double recursive 2nd order Butterworth filter. This is a 4th order filter (since the asymptotic response is f ), but NOT a 4th order Butterworth filter because its frequency response is 4 the square of the 2nd order filter: H( f ) = ---------------------- f + ----- 4 Matlab functions: BUTTER: get coefficients a,b,... for a Butterworth filter with specific order and cut-off frequency FILTER: filter data FILTFILT: filter data twice, forward and reverse Notes:. Recursive digital filters always have a time lag between input and output, non-recursive filters (where y is not fed back to the input side) can be made with zero-lag but do not allow a good approximation to a Butterworth filter. Solution for the time lag problem: filter twice, second time in reverse direction. 2. Digital filters require constant sampling interval. 3. It is not (yet) clear to me how the Matlab implementation deals with boundary conditions. f 0 3.3. Curve fitting (or non-linear regression) Matlab functions: POLYFIT to get coefficients of best-fitting polynomial POLYVAL to evaluate polynomial at arbitrary time values POLYDER to evaluate first derivative at arbitraty time values LEASTSQ( model, parameters) for other nonlinear regression problems Other software: spreadsheet (Lotus, Excel), statistics (SPSS, SAS). Applications: e.g. quantification of force-deformation curves. 3

Notes:. Apply only when underlying function is simple; high order polynomials are dangerous when extrapolated and give large errors in derivatives at the endpoints. 2. Does NOT correspond to a low-pass filter! (frequency response depends on data) 3.4. Smoothing splines A n th degree spline function f ( t) is a piecewise n th degree polynomial function. The polynomials are joined at the nodes ( t-values in the input data) in such a way that all derivatives up to the ( n ) th are continuous. Within these constraints, the function f ( t) is selected which minimizes: ( f ( t i ) x i ) 2 2 2 + p f ( t) dt where ( t i, x i ) are the raw data samples, and f ( k) denotes the k th derivative of f ( t). The weight factor p is the smoothing parameter. With p = 0, an interpolating spline will be obtained, with p = a least squares fit of the entire dataset using a single polynomial of degree ( n ) /2 (e.g. a straight line for n =3. Intermediate values give a compromise between good fit (the first term in the equation) and the smoothness (the second term). The degree n should be odd: n = 3,5,7 for cubic, quintic, heptic splines. Matlab function: CSAPS: 3rd degree (cubic) smoothing spline n + ----------- Stand-alone program: GCV: any odd order spline, with many options to select smoothing parameter. See documentation (FrameMaker file) ~bogert/help/gcv.fm. Fortran library: GCVSPL: this library by Herman Woltring is used in the GCV program and can also be used in your own Fortran programs. You can interface it with Matlab too. See http://www.kin.ucalgary.ca/ isb/software. Notes:. Sampling interval does not have to be constant for a spline method. 2. Differentiation is not an additional finite difference approximation, as in the digital filter, but can be done directly from the equations of the polynomials. The GCVSPL package includes a function SPLDER (spline derivative) that does this for you. n + ----------- 2 3. Boundary conditions: f = 0, so use quintic spline if you need acceleration. 3.5. Fourier analysis Matlab: 4

FFT (fast fourier transform), followed by reduction of amplitudes of high frequencies, followed by IFFT (inverse fft) Notes:. Simply setting high frequencies to zero can cause ringing near sudden transitions in the input signal. 2. Boundary conditions: f ( n) ( 0) = f ( n) ( T ) for function ( n = 0) and all derivatives ( n =, 2, ). Real movement data (especially non-cyclic data) does not satisfy these conditions. Both drawbacks are to some extent avoided in the method published by Hatze (98). 4. Choosing the optimal filter This is typically an interactive trial and error process. The goodness of a filter is best based on visual inspection of the results. Also note that it depends on the subsequent steps in the analysis too. For instance, a good filter for peak detection may be one which reduces noise to % of the signal. The same filter may not be good for differentiation, because the noise in the derivative is still to high. Filters for differentiation typically need a lower cut-off frequency. The GCV software includes two optimization methods to select a p-value objectively. The first requires an estimate of the magnitude of the noise, the second (the generalized cross-validation criterion) tries to make an estimate of the noise. The latter method tends not to work well for choosing an optimal filter for differentiation (it tends to smooth not enough), but your mileage may vary. 5. References Hatze, H. (98) The use of optimally regularized Fourier series for estimating higher-order derivatives of noisy biomechanical data. J. Biomech. 4,3-8. (describes a Fourier series method) Pezzack, J.C., R.W. Norman, and D.A. Winter (977) An assessment of derivative determining techniques used for motion analysis. J. Biomechanics 0,377-382. (describes digital filtering method and benchmark data) Woltring, H.J., Smoothing and differentiation techniques applied to 3-D data, in Three-Dimensional Analysis of Human Movement, ed. P. Allard, I.A.F. Stokes, J.-P. Blanchi, Human Kinetics Publishers, Urbana-Champaign, Illinois/USA. (good overview and mathematical background) Woltring, H.J. (986) A Fortran package for generalized, cross-validatory spline smoothing and differentiation. Adv. Engng. Softw. 8,04-0. (describes spline method, very technical) Wood, G.A. (982) Data smoothing and differentiaion procedures in biomechanics. Exerc. Sport Sciences Rev. 0,308-362. (good overview) 5

NOTE: if you suggestions for additions or revisions to this document, please contact me at bogert@acs.ucalgary.ca 6