Wednesday, December 26, 2007

Analog and digital filters BASICS

In signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or to extract useful parts of the signal, such as the components lying within a certain frequency range.

There are two main kinds of filter, analog and digital. They are quite different in their physical makeup and in how they work.

An analog filter uses analog electronic circuits made up from components such as resistors, capacitors and op amps to produce the required filtering effect. Such filter circuits are widely used in such applications as noise reduction, video signal enhancement, graphic equalisers in hi-fi systems, and many other areas.
There are well-established standard techniques for designing an analog filter circuit for a given requirement. At all stages, the signal being filtered is an electrical voltage or current which is the direct analogue of the physical quantity (e.g. a sound or video signal or transducer output) involved.
A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. The processor may be a general-purpose computer such as a PC, or a specialised DSP (Digital Signal Processor) chip.

The analog input signal must first be sampled and digitised using an ADC (analog to digital converter). The resulting binary numbers, representing successive sampled values of the input signal, are transferred to the processor, which carries out numerical calculations on them. These calculations typically involve multiplying the input values by constants and adding the products together. If necessary, the results of these calculations, which now represent sampled values of the filtered signal, are output through a DAC (digital to analog converter) to convert the signal back to analog form.
Note that in a digital filter, the signal is represented by a sequence of numbers, rather than a voltage or current.

Introduction

The importance of digital filters is well established. Digital filters, and more generally digital signal processingalgorithms, are classified as discrete-time systems. They are commonly implemented on a general purpose computeror on a dedicated digital signal processing (DSP) chip. Due to their well-known advantages, digital filters are oftenreplacing classical analog filters.
In this application note, we introduce a new digital filter design and analysis toolimplemented in LabVIEW with which developers can graphically design classical IIR and FIR filters, interactivelyreview filter responses, and save filter coefficients. In addition, real-world filter testing can be performed within thedigital filter design application using a plug-in data acquisition board.Digital Signal Processing (DSP) affords greater flexibility, higherperformance (in terms of attenuation and selectivity), bettertime and environment stability and lower equipment productioncosts than traditional analog techniques. Additionally, more andmore microprocessor circuitry is being displaced with costeffectiveDSP techniques and products; an example of this isthe emergence of DSP in cellular base stations.
Componentsavailable today let DSP extend from baseband to intermediatefrequencies (IFs). This makes DSP useful for tuning and signalselectivity, and frequency up and down conversion.These new DSP applications result from advances in digitalfiltering. This Application Note will overview digital filtering byaddressing concepts which can be extended to basebandprocessing on programmable digital signal processors.

Classical FIR Filter Design

The classical FIR Design panel (Fig. 2) is used to design FIR filters.
These filters include the classic types such aslowpass, highpass, bandpass, and bandstop and employ the Parks-Mclellan equiripple FIR filter design algorithm.This panel is very similar to the Classical IIR Design panel and operates in much the same way. The panel includesa graphical interface with the Magnitude vs Frequency cursors and plot on the left side and a text-based interface withdigital controls on the right side. You design classical FIR filters adjusting the desired filter specifications.
Thedesired passband and stopband requirements define a filter specification. You define the filter requirements by usingeither text entry or the cursors in the Magnitude vs Frequency graph. As the cursors are moved, the text entries areupdated accordingly.

Advantages of using digital filters

The following list gives some of the main advantages of digital over analog filters.

1. A digital filter is programmable, i.e. its operation is determined by a program stored in the processor'smemory. This means the digital filter can easily be changed without affecting the circuitry (hardware).An analog filter can only be changed by redesigning the filter circuit.
2. Digital filters are easily designed, tested and implemented on a general-purpose computer orworkstation.
3. The characteristics of analog filter circuits (particularly those containing active components) aresubject to drift and are dependent on temperature. Digital filters do not suffer from these problems,and so are extremely stable with respect both to time and temperature.
4. Unlike their analog counterparts, digital filters can handle low frequency signals accurately. As thespeed of DSP technology continues to increase, digital filters are being applied to high frequencysignals in the RF (radio frequency) domain, which in the past was the exclusive preserve of analogtechnology.
5. Digital filters are very much more versatile in their ability to process signals in a variety of ways; thisincludes the ability of some types of digital filter to adapt to changes in the characteristics of thesignal.
6. Fast DSP processors can handle complex combinations of filters in parallel or cascade (series),making the hardware requirements relatively simple and compact in comparison with the equivalentanalog circuitry.

Recursive and non-recursive filters

For all the examples of digital filters discussed so far, the current output (yn) is calculated solely from thecurrent and previous input values (xn, xn-1, xn-2, ...). This type of filter is said to be non-recursive.A recursive filter is one which in addition to input values also uses previous output values. These, like theprevious input values, are stored in the processor's memory.The word recursive literally means "running back", and refers to the fact that previously-calculated outputvalues go back into the calculation of the latest output.
The expression for a recursive filter therefore containsnot only terms involving the input values (xn, xn-1, xn-2, ...) but also terms in yn-1, yn-2, ...From this explanation, it might seem as though recursive filters require more calculations to be performed,since there are previous output terms in the filter expression as well as input terms.

In fact, the reverse isusually the case:
to achieve a given frequency response characteristic using a recursive filter generally requiresa much lower order filter (and therefore fewer terms to be evaluated by the processor) than the equivalent nonrecursivefilter. This will be demonstrated later.