470 likes | 895 Views
Introduction to Digital Filtering. Dr Christina Orphanidou christina.orphanidou@eng.ox.ac.uk. Signals. Signals are functions of independent variables that carry information. Electrical signals-voltages and currents in a circuit-the ECG. Acoustic signals-audio and speech
E N D
Introduction to Digital Filtering Dr Christina Orphanidou christina.orphanidou@eng.ox.ac.uk
Signals Signals are functions of independent variables that carry information • Electrical signals-voltages and currents in a circuit-the ECG. • Acoustic signals-audio and speech • Image/video signals-variations in the intensity in an image-CT scans, MRI. • Biological signals-sequence of bases in a gene. Most of these signals are continuous: x(t) where t is the continuous independent variable, usually time. (analog/analogue) Others (such as the sequence of DNA bases or the digital image pixels) are discrete: x[n], where n is the discrete independent variable which takes only integer values. (digital) In order for digital computers to process real-world signals they need to be discrete. In this course we are dealing with 1-D discrete signals.
Discrete-time system Given a discrete input series what we need to build is a system which takes the input signal and alters it such as the output has some more desired properties. The most useful class of systems to do that are digital filters.
Discrete-time system Given a discrete input series what we need to build is a system which takes the input signal and alters it such as the output has some more desired properties. DIGITAL FILTER The most useful class of systems to do that are digital filters.
Filter Operations Air filters, water filters.....remove unwanted substances, most often separate based on the size (scale) of things... Digital filters do just the same and the “scale” of things is determined by the frequency content of the signal. The name “filter” is used because these signal-processing elements typically “pass” or amplify certain frequency components of the signal, while they “stop” or attenuate others. De-noising e.g. real biomedical data Amplifying certain frequencies-hearing aids Limiting transmission bandwidth-radio channels
Analysis • We analyze Digital filtering algorithms by determining: • Their time-domain characteristics • Linear Difference Equations • Filter’s unit sample (impulse) response • Their frequency-domain characteristics • Z-transform domain • System transfer function • Poles and zeros diagram in the z-plane • Fourier domain • Frequency response • Spectrum of the signal
Analysis • We analyze Digital filtering algorithms by determining: • Their time-domain characteristics • Linear Difference Equations • Filter’s unit sample (impulse) response • Their frequency-domain characteristics • Z-transform domain • System transfer function • Poles and zeros diagram in the z-plane • Fourier domain • Frequency response • Spectrum of the signal
Filters defined by Linear Difference Equations A discrete time system is any mathematical transformation which maps a discrete time input signal x[n] into a discrete time output signal y[n]. An important class of digital filters is those defined by a linear difference equation (of constant and real coefficients): (1) Equation (1) can be used to compute the output y[n] at any time n from a finite number of previous values of the input x[n] and the output. The maximum of the numbers K and M is called the order of the system.
Elements of a digital filter (and examples) y[n]=Gx[n] Simple gain or amplifiers y[n]=x[n-n0] Delay of n0 samples. Any digital filter is a combination of gains and delays. • Two-point moving-average: • 2. Euler’s formula for approximating the derivative of a continuous-time function: where Tsis the sampling interval.
More digital filter examples 3. Averaging over N consecutive epochs of duration L. 4. Trapezoidal integration formula 5. First order low-pass filter 6. Digital resonator
FIR and IIR filters Digital filters can be classified on the basis of the coefficients of the basic difference equation. • FIR filters: if all the ak coefficients are zero then the output depends only on a finite • number of values of the input. Such filters are called finite impulse response (FIR), all-zero, • or moving-average (MA) filters. • 2. IIR filters: if at least one of the akcoefficients is non-zero the filter is said to have infinite • impulse response (IIR). They are also called all-pole or autoregressive since they also depend • on past values of the output. (these names will make sense later) The distinction between IIR and FIR is important since signal processing techniques and implementation issues are quite different.
LTI Systems • An important category of discrete-time systems are those which have the properties of • linearity and time-invariance • Linearity (principle of superposition and scaling) • Time-invariance • Systems with these two properties are Linear Time Invariant (LTI)
LTI and digital filters By inspecting equation (1) we can see that all digital filters (FIR) and (IIR) with constant coefficients are LTI. If, for example, the coefficients ak and bmdepend on n the system is then linear but not time-invariant. A strict definition of digital filters includes only the LTI ones...however, in practice, the term “filter” often refers to non-linear systems that resemble LTI systems in some ways. Example: the median filter which gives as output the median of a finite number of input samples. The filter is time-invariant but non-linear. What would a median filter be useful for?
Median filter action Before MF After MF Spikes are gone! medfilt1.m
Response of LTI systems to arbitrary inputs Keeping in mind that digital filters defined by linear difference equations (with constant coefficients) are an important class of LTI systems we will now consider their general properties. The unit sample δ[n] is also called the discrete-time impulse and is defined by: unit sample/impulse The response of an LTI system to an arbitrary signal can be completely characterized by its response to the unit sample, aka its impulse response.
Response of LTI systems to arbitrary inputs This property can be proven by writing the input signal x[n] as a weighted sum of delayed impulses Decomposition of the triangular signal Δ5[n-2] into a weighted sum of unit samples.
Response of LTI systems to arbitrary inputs LTI δ[n] h[n] Now if Impulse response If we know the impulse response we can determine the response of the system to any arbitrary input.. LTI Time-invariance δ[n-m] h[n-m] LTI Scaling property x[m]δ[n-m] x[m]h[n-m] by superposition Discrete convolution
Properties of convolution By making the substitution of variable l=n-m, it is easy to show that Therefore, convolution is commutative. Also, Therefore, convolution is associative.
Combinations of filters When the output of a filter with impulse response h1[n] is used as input to another filter with impulse response h2[n], the two filters are said to be placed into a cascade. From the associative property we can see that the impulse response of cascaded filters is simply the convolution of their impulse responses. Because of the commutative property, the result also implies that the output of a cascade of LTI filters does not change if the order of the filter changes.
Combinations of filters Simple manipulations can show that: Convolution is therefore distributive over addition. As a result of this property, the impulse response of a parallel combination of filters is the sum of the individual impulse responses.
Causality and stability A discrete-time system is said to be causal if its response at time n0 depends only on the input for times . A system is said to be stable if a bounded input gives a bounded output. For an LTI system to be stable, it is necessary and sufficient that its impulse response is absolutely summable: If x[n] is a bounded signal i.e for all n, it can be shown that:
Summary An advanced class of digital filters are discrete-time systems defined by linear, constant coefficient difference equations. Such filters are part of a broader class of linear, time-invariant (LTI) systems. LTI systems are completely characterised by their impulse response h[n] , in the sense that the response y[n] to an arbitrary input signal x[n] can be computed by means of the discrete convolution: If only a finite number of samples of the impulse response are non-zero, the filter is said to have finite impulse response (FIR). FIR filters are always stable and their impulse response can be found by inspection of the difference equation.
Class exercise • Plot the impulse responses of the FIR filters defined earlier.
y[n]=Gx[n] Simple gain or amplifiers y[n]=x[n-n0] Delay of n0 samples. • Two-point moving-average: • 2. Euler’s formula for approximating the derivative of a continuous-time function: where Tsis the sampling interval. 3. Averaging over N consecutive epochs of duration L 4. Trapezoidal integration formula 5. First order low-pass filter