1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Anatomy of a Robot Part 12 pptx

20 304 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 20
Dung lượng 447,76 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

■ If we concatenate 2 such analog filters, we would get a 24 db per octave rolloff and it would only be something less than 2 octaves to achieve the same results: To get the stopband dow

Trang 1

To get the stopband down to 40 db at the Nyquist Frequency with this filter, we’d have to increase the sampling rate by a factor of 10 or so (3 octaves )

■ If we concatenate 2 such analog filters, we would get a 24 db per octave rolloff and it would only be something less than 2 octaves to achieve the same results:

To get the stopband down 40 db at the Nyquist Frequency with this filter, we’d have to increase the sampling rate by a factor of 3.7 or so: (2 octaves ) This would be a good trade-off since the analog filters are relatively inexpensive, and the DSP filters can be expensive, depending on the technology used

■ If we concatenate 3 such analog filters, we would get a 36 db per octave rolloff and it would only be something more than 1 octave to achieve the same results:

To get the stopband down 40 db at the Nyquist Frequency with this filter, we’d have to increase the sampling rate by a factor of 2.1 or so: (1 octave ) This, too, would be a good trade-off Details about analog filters can be found at http://my.integritynet.com.au/purdic/lcfilters.htm and at www.freqdev.com/guide/ FDIGuide.pdf

(1 octave  36 db/octave  4 db)  40 db (2 octaves  24 db/octave  8 db)  40 db

FIGURE 8-10 The step input response of the second-order analog filter

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6

x Amplitude

Time

Trang 2

DSP FILTERS

There’s no reason not to make an antialias filter using DSP techniques We’ll be dis-cussing how to synthesize a DSP filter next Here are some good web sites and a PDF file covering antialiasing filters:

■ www.alligatortech.com/why_low_pass_filtering_is_always_necessary.htm

■ www.dactron.com/pdf/appnote/aliasprotection.pdf

■ http://kabuki.eecs.berkeley.edu/⬃danelle/arpa_0697/arpa.html

■ http://members.ozemail.com.au/⬃timhoop/intro.htm

D/A Effects: Sinc Compensation

At the output of the DSP system, the D/A generates an output stream of analog values The D/A only outputs a series of analog values that look like a rectangular staircase of constant voltages Thus, the D/A inherently alters the output signal with the sinc func-tion, which we’ll discuss again shortly What’s needed within the DSP filter is an anti-sinc compensation filter

This antisinc precompensation filter can reside inside the DSP compute engine Let’s say the DSP compute engine generates D/A output values at a rate of N per second The antisinc predistortion computations are now added at the tail end of the DSP compute engine Just how this is done is up to the designer Since all these systems are assumed

to be Linear Time Invariant systems, the antisinc filter can simply be added right into the middle of the DSP calculations The previous D/A results are fed into this new com-pute block that runs computations for the antisinc compensation The result is a new compute block outputting a stream of D/A values at a rate faster than rate N The D/A will then run at a higher rate than normal We smooth out the D/A values with a simple low-pass filter at the D/A clock rate The resulting output waveform will not be overly distorted by the sinc effect Note that running the D/A at a faster rate will mean higher energy consumption

Here are some PDFs further discussing sinc precompensation:

■ http://pdfserv.maxim-ic.com/arpdf/AppNotes/A0509.pdf

■ www.lavryengineering.com/pdfs/sample.pdf

■ www.ee.oulu.fi/⬃timor/EC_course/chp_1.pdf

Trang 3

DSP Filter Design

DSP filters are engines that do just exactly that: They process digital signals DSP filters

process digital data in an organized way DSP can be accomplished in hardware

Field-Programmable Gate Array (FPGAs) or the processing can be done in software Even a

general-purpose computer can perform DSP calculations DSP filters are a mathemati-cal construct that can be realized in various physimathemati-cal ways We will discuss the mathe-matical structure first and the physical implementation much later in a separate section Until we get to that section, none of the following discussion refers to specific physical implementations This is a discussion in mathematical terms

DSP filters process a digital stream that represents a signal The stream of data will

be recomputed in a coordinated way to form the output stream of the filter It is the nature of the computation that gives the DSP filter the desired frequency transfer func-tion DSP filters can be constructed in many ways, but a few standard ways exist for building such a filter A standard DSP filter is defined by its structure: a generic sequence of arithmetic operations executed on the input data stream To make a custom filter, designers take a standard DSP filter and modify it Tools and formulae convert the custom filter transfer function to a set of alterations of the standard DSP filter The alterations, when made, turn the standard DSP filter into the custom filter To actually construct the custom filter, the designers map both the standard DSP filter and the cus-tom alterations to a physical implementation

One of the simpler standard structures for a DSP filter is the Finite Impulse Response

(FIR) filter shown in Figure 8-11 The data sequences through a linear series of regis-ters called taps At each sampling clock, the data moves to the next tap After the last tap, the data is discarded The output of the FIR filter at each clock is generally a sin-gle data element formed by combining all the data in all the taps The data in each tap

is multiplied by that tap’s coefficient and the results are summed to make the output data It is the vector of coefficients that turns the standard DSP FIR structure into the custom FIR filter Once the designers decide that a custom FIR filter can be built with the standard FIR structure (a process to be discussed later), few design tasks remain other than the generation of the coefficients

The coefficients for a FIR filter can be designed in many ways We would need another whole book to describe all the methods Instead, we’re going to describe per-haps the simplest, most general way to design a FIR filter The technique uses Fourier transforms and a technique called windowing We won’t go fully into exactly why this technique works, but rather how it works

The technique is general because it enables the construction of a filter with an arbi-trary frequency transfer function The designer can describe a custom-shaped frequency

Trang 4

response (within bounds) and then apply the techniques In practice, most filters have very specific functions and the following four filters are the most commonly used designs Figure 8-12 shows low-pass, high-pass, band-pass, and band-stop filters:

fil-ter’s cutoff frequency Primarily, the cutoff frequency and the cutoff attenuation characterize the filter It is commonly used to eliminate high-frequency noise or

as an antialias filter

FIGURE 8-11 FIR filter structure

Output

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

Tap Register Tap Coefficient

X

+

Input

Trang 5

High-pass The high-pass filter is designed to eliminate frequencies below the filter’s cutoff frequency Primarily, the cutoff frequency and the cutoff attenuation characterize the filter It is commonly used to eliminate a 60 Hz hum in systems

or to accentuate high-frequency components in audio channels

those within a narrow band The filter is characterized primarily by the two fre-quencies (start of band and end of band) and the cutoff attenuation

a narrow band The filter is characterized primarily by the two frequencies (start

of band and end of band) and the cutoff attenuation

The Fourier approach to designing an FIR filter starts with the required shape of the filter transfer function The four previous filters are examples, and we will move for-ward with the low-pass example The math that follows is general and applies to any filter transfer function (within certain bounds) The URLs cited later allow designers to specify filter parameters and start a computation The computations executed on the web sites use math similar to the math we’ll describe next

Subject to conditions, a simple filter’s frequency response can be put in the general form:

where N will become the number of taps in the FIR filter c(n) will become the coeffi-cient of the nth tap Or by mathematical substitution,

F(jv)  兺 (n  0, N  1) (c(n)  (cos(nv)  j sin( nv)))

F(jv)  兺 (n  0 , N  1) (c(n)  e jnv)

FIGURE 8-12 Different types of filters for different purposes

Trang 6

Figuring out the coefficient c(n) from this formula might involve some difficult cal-culus with an integral over a range of 2p This is the case for a general-purpose (cus-tom) frequency response, but if the frequency response curve is like the low-pass filter, the calculations are simpler The gain is flat at a value of 1 and then drops off completely (in the ideal math equation) Taking advantage of the simplified filter shape, and with

a few other mathematical manipulations, the integral reduces to a closed math solution

as follows:

Using the math identity sinc (x)  sin(x)/x,

The sinc function is well known as the spectral envelope of a train of pulses Figure 8-13 shows the shape of the sinc function

One of the difficulties of the Fourier method is that it produces an infinite set of coef-ficients This presents a problem because we cannot have an infinite number of taps in the FIR filter If we simply eliminate some taps, the filter won’t work as designed or simulated

Instead, various techniques are used to minimize the taps to a conveniently small number These techniques create a window value for every coefficient in the infinite series All the coefficients are multiplied by the window during the FIR filter compu-tations All these windows limit the number of coefficients to the desired number of taps because the window has a value of zero for taps outside the range of the window

c(n)  v sinc (nv)/p

c(n)  (sin (nv)/np)

FIGURE 8-13 The sinc function

-0.4 -0.2 0 0.2 0.4 0.6 0.8 1 1.2

1

SINC (x) = Sin (x) / x

Trang 7

This means the FIR filter can be limited to a specific number of taps based on the win-dow Most of these windows keep the center taps (generally with the largest coeffi-cients) and decrease the size of the window to zero as it reaches the edge coefficients The windows have well-known names and predictable effects on the filter They are automatically added to the calculations since a window must be used to have a calcu-lation at all The URLs that follow allow us to perform calcucalcu-lations using JAVA tools They have the windows built in to the Java tool that computes the coefficients and shows you the resultant filter transfer function Each window has its strength and weaknesses, but we must choose a window for every calculation Some of the windows are outlined here In each case, we show the shape of the window In addition, we show a FIR filter built with all the same parameters except for the choice of window type

to 1 around the center coefficient This is true right to the edge of the filter Outside the filter, all the coefficients are zeroed out of the window The window chart has a characteristic rectangular shape The rectangular window is easy to compute on the fly since only multiplication by unity is required Most FIR filter coefficients, however, are precomputed during the design phase (see Figure 8-14) The math behind the rectangular window is explained at http://mathworld wolfram.com/UniformApodizationFunction.html

win-dow value to a linearly decreasing value starting at the center coefficient Right at the edge of the filter, it reaches zero Outside the filter, all the coefficients are

FIGURE 8-14 Rectangular DSP window and frequency response

0 db

-20 db

-40 db

-60 db

-80 db

-100 db

-120 db

Trang 8

zeroed out of the window The window chart has a characteristic triangular shape (see Figure 8-15) The math behind the Bartlett function is explained at http:// mathworld.wolfram.com/BartlettFunction.html

that we’ll discuss later (see Figure 8-16) The math behind the Hanning window

is shown at http://mathworld.wolfram.com/HanningFunction.html

FIGURE 8-15 Triangular DSP window and frequency response

0 db -20 db -40 db -60 db

-80 db -100 db -120 db

FIGURE 8-16 Hanning DSP window and frequency response

0 db -20 db

-40 db -60 db -80 db -100 db -120 db

Trang 9

Hamming window This is a minor modification of the Hanning window (see Figure 8-17) The math behind the Hamming window is shown at http://mathworld wolfram.com/HammingFunction.html

Blackman window has an extra term to reduce the ripple (see Figure 8-18) The

FIGURE 8-17 Hamming DSP window and frequency response

0 db -20 db -40 db -60 db -80 db -100 db -120 db

FIGURE 8-18 Blackman DSP window and frequency response

0 db -20 db -40 db -60 db -80 db -100 db -120 db

Trang 10

math behind the Blackman window is shown at http://mathworld.wolfram.com/ BlackmanFunction.html More windows are shown at these sites:

■ http://astronomy.swin.edu.au/⬃pbourke/analysis/windows/

■ http://mathworld.wolfram.com/ApodizationFunction.html

■ www.filter-solutions.com/FIR.html#asinxx Among the web sites dedicated to filtering, the FIR Filter Design by Windowing site has a nice user interface where you can see the results of an FIR filter design (http://web.mit.edu/6.555/www/fir.html) It was used to make this chapter’s figures To use the tool, change the parameters, reselect the window type on the top pulldown list

to recompute the coefficients, and redisplay the results

In playing with this utility, I suggest altering just one parameter at a time Try run-ning a few other experiments as well Notice how increasing the number of taps makes the filter rolloff sharper Also notice that the ripple in the filter is largely unaffected by having more taps

Physical Implementation of DSP Filters

As we mentioned before, all the DSP techniques we’ve mentioned so far are mathe-matical in nature

FIR FILTERS

The physical implementation of antialiasing and dithering circuits notwithstanding, the structure of a FIR filter is theoretical: a series of registers, coefficients, and adders that form an arithmetic output The DSP calculations can be performed in hardware or soft-ware In most cases, the calculations could be done either way

Software

Those of us who build hardware for a living can relate to feelings of frustration when

it comes to DSP software Somehow DSP programmers feel the DSP answers just float out of the air, computations unsullied by the presence of hardware or electrons The truth is, DSP computers are very much hardcore hardware, specially designed for DSP calculations We’ve discussed DSP computers previously in the book, so I won’t go into the structure The DSP chips are specially designed to be efficient at handling the types

of calculations that are required for FIR filters Specific logical structures within the

Ngày đăng: 10/08/2014, 01:22