Vous êtes sur la page 1sur 17

CHAPTER 19 - Recursive Filters Recursive filters are an efficient way of achieving a long impulse response, without having to perform

a long convolution. They execute very rapidly, but have less performance and flexibility than other digital filters. Recursive filters are also called Infinite Impulse Response (IIR) filters, since their impulse responses are composed of decaying exponentials. This distinguishes them from digital filters carried out by convolution, called Finite Impulse Response (FIR) filters. This chapter is an introduction to how recursive filters operate, and how simple members of the family can be designed. Chapters 20, 26 and 33 present more sophisticated design methods. Filtros recursivos so uma forma eficiente de conseguir uma resposta de impulso de comprimento, sem ter de efectuar uma convoluo de comprimento. Eles executam muito rpido, mas tem menos desempenho e flexibilidade do que outros filtros digitais. Filtros recursivos so tambm chamados de Infinite resposta ao impulso (IIR) filtros, uma vez que as respostas de seus impulsos so compostas de exponenciais em decomposio. Isso os distingue de filtros digitais realizados por convoluo, chamado Finite Impulse Response (FIR) filtros. Este captulo uma introduo de como filtros recursivos operar, e como os membros simples da famlia pode ser concebido. Captulos 20, 26 e 33 apresentam mtodos mais sofisticados de design. O mtodo recursivo Para iniciar a discusso de filtros recursivos, imagine que voc precisa para extrair informaes de algum sinal, x []. Sua necessidade to grande que voc contratar um professor de matemtica de idade para processar os dados para voc. A tarefa do professor a de filtrar x [] para produzir y [], que espero que contm as informaes que voc est interessado polegadas O professor comea a sua obra de clculo de cada ponto y [] de acordo com algum algoritmo que est bloqueado firmemente na sua sobredesenvolvido crebro. No meio da tarefa, um evento mais infeliz ocorre. O professor comea a balbuciar sobre singularidades analticas e transformaes fracionrios, e outros demnios de pesadelo de um matemtico. claro que o professor perdeu sua mente. Voc assiste com ansiedade como o professor, e seu algoritmo, so levados por vrios homens vestidos de branco. Voc freneticamente revisar notas do professor para encontrar o algoritmo que ele estava usando. Voc acha que ele havia terminado o clculo de pontos y [0] a y [27], e estava prestes a comear no ponto y [28]. Como mostrado na fig. 19-1, vamos deixar a varivel

The Recursive Method To start the discussion of recursive filters, imagine that you need to extract information from some signal, x[ ] . Your need is so great that you hire an old mathematics professor to process the data for you. The professor's task is to filter x[ ] to produce y[ ] , which hopefully contains the information you are interested in. The professor begins his work of calculating each point in y[ ] according to some algorithm that is locked tightly in his over-developed brain. Part way through the task, a most unfortunate event occurs. The professor begins to babble about analytic singularities and fractional transforms, and other demons from a mathematician's nightmare. It is clear that the professor has lost his mind. You watch with anxiety as the professor, and your algorithm, are taken away by several men in white coats.

You frantically review the professor's notes to find the algorithm he was using. You find that he had completed the calculation of points y[0] through y[27] , and was about to start on point y[28] . As shown in Fig. 19-1, we will let the variable, n, represent the point that is

currently being calculated. This means that y[n] is sample 28 in the output signal, y[n& 1] is sample 27, y[n& 2] is sample 26, etc. Likewise, x[n] is point 28 in the input signal, x[n& 1] is point 27, etc. To understand the algorithm being used, we ask ourselves: "What information was available to the professor to calculate y[n] , the sample currently being worked on?"

n, representam o ponto que est sendo calculado. Isto significa que y [n] exemplo de 28 em sinal de sada, y [n & 1] amostra 27, y [n & 2] exemplo de 26, etc Da mesma forma, x [n] o ponto 28 no sinal de entrada, x [n & 1] o ponto 27, etc para entender o algoritmo a ser utilizado, nos perguntamos: "Qual a informao estava disponvel para o professor para calcular y [n], a amostra atualmente sendo trabalhado" A mais bvia fonte de informao o sinal de entrada, isto , os valores: x [n], x [n & 1], x [n & 2], . O professor pode ter sido multiplicando cada ponto no sinal de entrada por um coeficiente, e adicionando os produtos em conjunto:

The most obvious source of information is the input signal, that is, the values: x[n], x[n& 1], x[n& 2], . The professor could have been multiplying each point in the input signal by a coefficient, and adding the products together:

You should recognize that this is nothing more than simple convolution, with the coefficients: a0, a1, a2, , forming the convolution kernel. If this was all the professor was doing, there wouldn't be much need for this story, or this chapter. However, there is another source of information that the professor had access to: the previously calculated values of the output signal, held in: y[n& 1], y[n& 2], y[n& 3], . Using this additional information, the algorithm would be in the form:

Voc deve reconhecer que este nada mais do que convoluo simples, com os coeficientes: a0, a1, a2, , formando o ncleo de convoluo. Se tudo isso foi o professor estava fazendo, no haveria tanta necessidade para esta histria, ou neste captulo. No entanto, h outra fonte de informao que o professor tinha acesso a: os valores anteriormente calculados do sinal de sada, realizada em: y [n & 1], y [n & 2], y [n & 3], . Utilizando esta informao adicional, o algoritmo seria sob a forma:

EQUATION 19-1 The recursion equation. In this equation, x[ ] is A equao de recurso. Nesta equao, x [] o the input signal, y[ ] is the output signal, and sinal de entrada, y [] o sinal de sada, eo de the a's and b's are coefficients. um e b so coeficientes. In words, each point in the output signal is found by multiplying the values from the input signal by the "a" coefficients, multiplying the previously calculated values from the output signal by the "b" coefficients, and adding the products together. Notice that there isn't a value for b0 , because this corresponds to the sample being calculated. Ou seja, cada ponto no sinal de sada obtida multiplicando os valores do sinal de entrada por "A" coeficientes, multiplicando os valores previamente calculados a partir do sinal de sada pelos coeficientes "b", e adicionando os produtos em conjunto. Note-se que no h um valor para b0, porque esta corresponde amostra a ser calculado. Equao 19-1

Equation 19-1 is called the recursion equation, and filters that use it are called recursive filters. The "a" and "b" values that define the filter are called the recursion coefficients. In actual practice, no more than about a dozen recursion coefficients can be used or the filter becomes unstable (i.e., the output continually increases or oscillates). Table 19-1 shows an example recursive filter program.

chamada de equao de recurso, e filtros que o utilizam so chamados de filtros recursivos. Os valores de "a" e "b" que definem o filtro so chamados os coeficientes de recurso. Na prtica real, no mais do que cerca de uma dzia de coeficientes de recurso pode ser utilizado ou o filtro torna-se instvel (isto , a sada aumenta continuamente ou oscila). Tabela 19-1 mostra um exemplo de programa recursiva filtro. Filtros recursivos so teis porque ignorar um longo convoluo. Por exemplo, considerar o que acontece quando uma funo delta passado atravs de um filtro recursivo. A sada a resposta do filtro de impulso, e ser tipicamente uma oscilao sinusoidal que decai exponencialmente. Uma vez que esta resposta ao impulso de infinitamente longo, filtros recursivos so freqentemente chamados de resposta ao impulso infinita (IIR) filtros. Com efeito, os filtros recursivos convolve o sinal de entrada com um ncleo de filtro muito longo, embora apenas alguns coeficientes poucos esto envolvidos. A relao entre os coeficientes de recurso e da resposta do filtro dada por uma tcnica matemtica chamada de transformada z, o tema do captulo 33. Por exemplo, a transformada z pode ser usado para as tarefas, tais como: a converso entre os coeficientes de recurso ea resposta de frequncia, combinando em cascata e as fases paralelas em um nico filtro, a criao de sistemas recursivos que imitam os filtros analgicos, etc Infelizmente, o Z-transformao muito matemtico, e mais complicado do que a maioria DSP usurios esto dispostos a lidar com eles. Este o reino daqueles que se especializam em DSP. H trs maneiras para encontrar os coeficientes de recurso sem ter que entender a transformada z. Em primeiro lugar, este captulo fornece equaes de projeto para vrios tipos de filtros recursivos simples. Segundo, Captulo 20 fornece uma "cartilha" programa de computador para projetar os filtros mais sofisticados de Chebyshev passa-

Recursive filters are useful because they bypass a longer convolution. For instance, consider what happens when a delta function is passed through a recursive filter. The output is the filter's impulse response, and will typically be a sinusoidal oscillation that exponentially decays. Since this impulse response in infinitely long, recursive filters are often called infinite impulse response (IIR) filters. In effect, recursive filters convolve the input signal with a very long filter kernel, although only a few coefficients are involved.

The relationship between the recursion coefficients and the filter's response is given by a mathematical technique called the ztransform, the topic of Chapter 33. For example, the z-transform can be used for such tasks as: converting between the recursion coefficients and the frequency response, combining cascaded and parallel stages into a single filter, designing recursive systems that mimic analog filters, etc. Unfortunately, the ztransform is very mathematical, and more complicated than most DSP users are willing to deal with. This is the realm of those that specialize in DSP.

There are three ways to find the recursion coefficients without having to understand the z-transform. First, this chapter provides design equations for several types of simple recursive filters. Second, Chapter 20 provides a "cookbook" computer program for designing the more sophisticated Chebyshev low-pass and high-pass filters. Third, Chapter 26

describes an iterative method for designing recursive filters with an arbitrary frequency response.

baixa e passa-alta. Terceiro, Captulo 26 descreve um mtodo iterativo para a concepo de filtros recursivos com resposta de freqncia arbitrria.

100 'RECURSIVE FILTER 110 ' 120 DIM X[499] 'holds the input signal 130 DIM Y[499] 'holds the filtered output signal 140 ' 150 GOSUB XXXX 'mythical subroutine to calculate the recursion 160 ' 'coefficients: A0, A1, A2, B1, B2 170 ' 180 GOSUB XXXX 'mythical subroutine to load X[ ] with the input data 190 ' 200 FOR I% = 2 TO 499 210 Y[I%] = A0*X[I%] + A1*X[I%-1] + A2*X[I%-2] + B1*Y[I%-1] + B2*Y[I%-2] 220 NEXT I% 230 ' 240 END Single Pole Recursive Filters Figure 19-2 shows an example of what is called a single pole low-pass filter. This recursive filter uses just two coefficients, a0 ' 0.15 and b1 ' 0.85 . For this example, the input signal is a step function. As you should expect for a low-pass filter, the output is a smooth rise to the steady state level. This figure also shows something that ties into your knowledge of electronics. This lowpass recursive filter is completely analogous to an electronic low-pass filter composed of a single resistor and capacitor. Single Pole Filtros recursivos A Figura 19-2 mostra um exemplo do que chamado um nico mastro de filtro passabaixo. Este filtro recursivo utiliza apenas dois coeficientes, a0 de 0,15 e b1 '0,85. Para este exemplo, o sinal de entrada uma funo de passo. Como voc deve esperar de um filtro passa-baixa, a sada uma subida suave para o nvel de estado estacionrio. Esta figura tambm mostra algo que os laos em seu conhecimento de eletrnica. Este filtro passabaixo recursiva completamente anlogo ao an electrnicos filtro passa-baixo compostos por um nico resistor e condensador. A beleza do mtodo recursivo est na sua capacidade para criar uma grande variedade de respostas alterando apenas alguns parmetros. Por exemplo, a fig. 19-3 mostra um filtro com trs coeficientes: a0 dos 0,93, a1 'e 0,93 e b1' 0,86. Como mostrado pelas respostas passo semelhante, este filtro digital imita uma electrnica RC filtro passa-alto. Estes filtros nico plo recursivo so definitivamente algo que voc deseja manter em sua caixa de ferramentas DSP. Voc pode us-los para processar sinais digitais, assim

The beauty of the recursive method is in its ability to create a wide variety of responses by changing only a few parameters. For example, Fig. 19-3 shows a filter with three coefficients: a0 ' 0.93 , a1 ' & 0.93 and b1 ' 0.86 . As shown by the similar step responses, this digital filter mimics an electronic RC high-pass filter.

These single pole recursive filters are definitely something you want to keep in your DSP toolbox. You can use them to process digital signals just as you would use RC

networks to process analog electronic signals. This includes everything you would expect: DC removal, high-frequency noise suppression, wave shaping, smoothing, etc. They are easy to program, fast to execute, and produce few surprises. The coefficients are found from these simple equations:

como voc usaria redes RC para processar sinais analgicos de eletrnicos. Isso inclui tudo que voc esperaria: remoo de DC, de alta freqncia de supresso de rudo, onda modelagem, alisamento, etc Eles so fceis de programar, rpido para executar e produzir surpresas. Os coeficientes so encontrados a partir destas equaes simples:

EQUATION 19-2 Single pole low-pass filter. The filter's response is controlled by the parameter, x, a value between zero and one. The characteristics of these filters are controlled by the parameter, x, a value between zero and one. Physically, x is the amount of decay between adjacent samples. For instance, x is 0.86 in Fig. 19-3, meaning that the value of each sample in the output signal is 0.86 the value of the sample before it. The higher the value of x, the slower the decay. Notice that the filter becomes unstable if x is made greater than one. That is, any nonzero value on the input will make the output increase until an overflow occurs. The value for x can be directly specified, or found from the desired time constant of the filter. Just as RC is the number of seconds it takes an RC circuit to decay to 36.8% of its final value, d is the number of samples it takes for a recursive filter to decay to this same level: nico plo filtro passa-baixa. A resposta do filtro controlado pelo parmetro, x, um valor entre zero e um. As caractersticas destes filtros so controlados pelo parmetro, x, um valor entre zero e um. Fisicamente, x a quantidade de decaimento entre amostras adjacentes. Por exemplo, x de 0,86 na fig. 19-3, o que significa que o valor de cada amostra no sinal de sada de 0,86 o valor da amostra antes dela. Quanto maior o valor de x, o mais lento a decadncia. Note-se que o filtro torna-se instvel se x feita maior que um. Isto , qualquer valor diferente de zero na entrada far com que o aumento de sada at um excesso ocorre. O valor de x pode ser directamente especificado, ou encontrado a partir da constante de tempo desejada do filtro. Assim como R C o nmero de segundos que leva um circuito RC para se decomporem a 36,8% do seu valor final, d o nmero de amostras que leva para um filtro recursivo para se decomporem para este mesmo nvel:

EQUATION 19-4 Time constant of single pole filters. This equation relates the amount of decay between samples, x, with the filter's time constant, d, the number of samples for the filter to decay to 36.8%. For instance, a sample-to-sample decay of x ' 0.86 corresponds to a time constant of d ' 6.63 Constante de tempo de filtros nico plo. Esta equao relaciona a quantidade de cries entre amostras, x, com constante de tempo do filtro, d, o nmero de amostras para o filtro para se decomporem para 36,8%. Por exemplo, uma amostra de decaimento-aamostra de x '0,86 corresponde a uma

samples (as shown in Fig 19-3). There is also a constante de tempo de d' 6.63 amostras (como fixed relationship between x and the -3dB mostrado na Fig. 19-3). Existe tambm uma cutoff frequency, fC , of the digital filter: relao fixa entre X e a-3dB frequncia de corte, FC, do filtro digital:

EQUATION 19-5 Cutoff frequency of single pole filters. The amount of decay between samples, x, is related to the cutoff frequency of the filter, fC , a value between 0 and 0.5. Freqncia de corte de filtros nico plo. A quantidade de decaimento entre as amostras, x, est relacionada com a frequncia de corte do filtro, FC, um valor entre 0 e 0,5.

This provides three ways to find the "a" and Isso proporciona trs modos de encontrar o "b" coefficients, starting with the time constant, "A" e "b" coeficientes, comeando com a the cutoff frequency, or just directly picking x. constante de tempo, a freqncia de corte, ou x apenas diretamente picking. Figure 19-4 shows an example of using single pole recursive filters. In (a), the original signal is a smooth curve, except a burst of a high frequency sine wave. Figure (b) shows the signal after passing through low-pass and high-pass filters. The signals have been separated fairly well, but not perfectly, just as if simple RC circuits were used on an analog signal. Figura 19-4 mostra um exemplo de uso de filtros nico plo recursivo. Em (a), o sinal original uma curva suave, com excepo de uma exploso de uma onda de alta frequncia de seno. A Figura (b) mostra o sinal depois de passar atravs de filtros passa-baixo e passaalto. Os sinais foram separadas razoavelmente bem, mas no perfeitamente, como se circuitos simples RC foram usados em um sinal analgico. Figura 19-5 mostra as respostas em freqncia de vrios filtros nico plo recursivo. Estas curvas so obtidos por passagem de uma funo delta atravs do filtro para encontrar a resposta do filtro de impulso. A FFT ento usado para converter a resposta ao impulso para a resposta de frequncia. Em princpio, a resposta ao impulso infinitamente longo, no entanto, ele decai abaixo do rudo de arredondamento preciso nica aps aproximadamente 15 a 20 constantes de tempo. Por exemplo, quando a constante de tempo do filtro 6,63 d 'amostras, a resposta ao impulso pode ser contido em cerca de 128 amostras.

Figure 19-5 shows the frequency responses of various single pole recursive filters. These curves are obtained by passing a delta function through the filter to find the filter's impulse response. The FFT is then used to convert the impulse response into the frequency response. In principle, the impulse response is infinitely long; however, it decays below the single precision roundoff noise after about 15 to 20 time constants. For example, when the time constant of the filter is d ' 6.63 samples, the impulse response can be contained in about 128 samples.

The key feature in Fig. 19-5 is that single pole A principal caracterstica na fig. 19-5 que recursive filters have little ability to separate plo nico filtros recursivos tm pouca one band of frequencies from another. In other capacidade para separar uma banda de

words, they perform well in the time domain, and poorly in the frequency domain. The frequency response can be improved slightly by cascading several stages. This can be accomplished in two ways. First, the signal can be passed through the filter several times. Second, the z-transform can be used to find the recursion coefficients that combine the cascade into a single stage. Both ways work and are commonly used. Figure (c) shows the frequency response of a cascade of four lowpass filters. Although the stopband attenuation is significantly improved, the rolloff is still terrible. If you need better performance in the frequency domain, look at the Chebyshev filters of the next chapter.

frequncias a partir de outro. Em outras palavras, eles executam bem no domnio do tempo, e mal no domnio da frequncia. A resposta de freqncia pode ser melhorado ligeiramente em cascata vrias etapas. Isto pode ser realizado de duas formas. Em primeiro lugar, o sinal pode ser passada atravs de filtro diversas vezes. Em segundo lugar, a transformada z pode ser usado para determinar os coeficientes de recurso que combinam a cascata em uma nica etapa. Ambas as formas funcionam e so comumente usados. A Figura (c) mostra a resposta de frequncia de uma cascata de quatro filtros passa-baixa. Embora a atenuao da faixa de rejeio significativamente melhorada, o rolloff ainda terrvel. Se voc precisa de um melhor desempenho no domnio da freqncia, olhar para os filtros Chebyshev do prximo captulo. A quatro fases filtro low-pass comparvel aos filtros Blackman e gaussianas (parentes da mdia mvel, captulo 15), mas com uma velocidade de execuo muito mais rpida. As equaes de projeto para um estgio de quatro filtro passa-baixa so:

The four stage low-pass filter is comparable to the Blackman and Gaussian filters (relatives of the moving average, Chapter 15), but with a much faster execution speed. The design equations for a four stage low-pass filter are:

EQUATION 19-6 Four stage low-pass filter. These equations provide the "a" and "b" coefficients for a cascade of four single pole low-pass filters. The relationship between x and the cutoff frequency of this filter is given by Eq. 19-5, with the 2B replaced by 14.445. Narrow-band Filters A common need in electronics and DSP is to isolate a narrow band of frequencies from a wider bandwidth signal. For example, you may want to eliminate 60 hertz interference in an instrumentation system, or isolate the signaling tones in a telephone network. Two types of frequency responses are available: the band-pass and the band-reject (also called a notch filter). Figure 19-6 shows the frequency response of these filters, with the recursion coefficients provided by the following Quatro estgio de filtro passa-baixa. Essas equaes fornecem o "A" e "b" coeficientes de uma cascata de quatro nicos plos filtros passa-baixa. A relao entre X e da frequncia de corte deste filtro dada pela Equao. 19-5, com o 2B substitudo por 14,445. Filtros de banda estreita Uma necessidade comum em eletrnica e DSP isolar uma faixa estreita de freqncias de um sinal de maior largura de banda. Por exemplo, voc pode querer eliminar 60 hertz interferncia em um sistema de instrumentao, ou isolar os tons de sinalizao em uma rede telefnica. Dois tipos de respostas de frequncia esto disponveis: o passa-banda e da banda-rejeitar (tambm chamado um filtro de entalhe). Figura 19-6 mostra a resposta de freqncia desses filtros,

equations:

com os coeficientes de recurso fornecidos pelas equaes seguintes:

EQUATION 19-7 Band-pass filter. An example frequency response is shown in Fig. 19-6a. To use these equations, first select the center frequency, f, and the bandwidth, BW. Both of these are expressed as a fraction of the sampling rate, and therefore in the range of 0 to 0.5. Next, calculate R, and then K, and then the recursion coefficients. Filtro passa-banda. Uma resposta de frequncia exemplo mostrado na fig. 19-6a. Para usar essas equaes, primeiro selecione a frequncia central, f, ea largura de banda, BW. Ambos estes so expressos como uma fraco da taxa de amostragem, e, por conseguinte, na gama de 0 a 0,5. Em seguida, calcula-R, e, em seguida, K, e, em seguida, os coeficientes de recurso.

EQUATION 19-8 Band-reject filter. This filter is commonly called a notch filter. Example frequency responses are shown in Fig. 19-6b. Band-rejeitar filtro. Este filtro comumente chamado de filtro de entalhe. Exemplo respostas de frequncia so mostrados na fig. 19-6b. Dois parmetros devem ser seleccionado antes de utilizar essas equaes: f, a freqncia central e BW, a largura de banda (medido a uma amplitude de 0,707). Ambos estes so expressos como uma fraco da frequncia de amostragem, e, portanto, deve estar compreendida entre 0 e 0,5. A partir desses dois valores especificados, calcular as variveis intermedirias: R e K, e, em seguida, os coeficientes de recurso. Como mostrado em (a), o filtro passa-banda tem caudas relativamente grandes que se estendem a partir do pico principal. Isto pode ser melhorado por vrias etapas em cascata. Uma vez que as equaes de projeto so bastante longas, mais simples de implementar esta cascata, filtrando o sinal vrias vezes, ao invs de tentar encontrar os coeficientes necessrios para um nico filtro. A Figura (b) mostra exemplos de o filtro de banda-rejeitar. A largura de banda mais estreita que podem ser obtidos com preciso simples de cerca de 0,0003 da freqncia de

Two parameters must be selected before using these equations: f, the center frequency, and BW, the bandwidth (measured at an amplitude of 0.707). Both of these are expressed as a fraction of the sampling frequency, and therefore must be between 0 and 0.5. From these two specified values, calculate the intermediate variables: R and K, and then the recursion coefficients.

As shown in (a), the band-pass filter has relatively large tails extending from the main peak. This can be improved by cascading several stages. Since the design equations are quite long, it is simpler to implement this cascade by filtering the signal several times, rather than trying to find the coefficients needed for a single filter.

Figure (b) shows examples of the band-reject filter. The narrowest bandwidth that can be obtain with single precision is about 0.0003 of the sampling frequency. When pushed beyond

this limit, the attenuation of the notch will degrade. Figure (c) shows the step response of the band-reject filter. There is noticeable overshoot and ringing, but its amplitude is quite small. This allows the filter to remove narrowband interference (60 Hz and the like) with only a minor distortion to the time domain waveform.

amostragem. Quando empurrados para alm deste limite, a atenuao da fossa ir degradar. A Figura (c) mostra a resposta passo do filtro de banda-rejeitar. H superao notvel e de toque, mas a sua amplitude muito pequena. Isto permite que o filtro para remover interferncia de banda estreita (60 Hz e semelhantes), com apenas uma pequena distoro forma de onda no domnio do tempo. resposta fase Existem trs tipos de resposta de fase que um filtro pode ter: fase zero, fase linear, ea fase no-linear. Um exemplo de cada um destes mostrado na Figura 19-7. Como mostrado em (a), o filtro de fase zero caracterizada por uma resposta de impulso que simtrica em torno de zero amostra. A forma atual no importa, apenas que as amostras negativas numerados so uma imagem espelho das amostras positivas numeradas. Quando a transformada de Fourier tomada de forma de onda thissymmetrical, a fase ser inteiramente zero, como mostrado em (b). A desvantagem de o filtro de fase zero que requer a utilizao de ndices negativos, que pode ser inconveniente para trabalhar. O filtro de fase linear uma maneira de contornar isso. A resposta de impulso em (d) idntico ao mostrado em (a), excepto que foi deslocado para utilizar apenas positivos amostras numeradas. A resposta de impulso ainda simtrico entre a esquerda e direita, no entanto, a localizao de simetria foi deslocado a partir de zero. Esta mudana resultados na fase de, (e), sendo uma linha recta, representando o nome: fase linear. O declive desta linha recta directamente proporcional quantidade do deslocamento. Uma vez que a mudana na resposta de impulso no faz nada mas produzem uma mudana idntica no sinal de sada, o filtro de fase linear equivalente ao filtro de fase zero para a maioria das finalidades. A Figura (g) mostra uma resposta de impulso que no simtrico entre a esquerda e direita.

Phase Response There are three types of phase response that a filter can have: zero phase, linear phase, and nonlinear phase. An example of each of these is shown in Figure 19-7. As shown in (a), the zero phase filter is characterized by an impulse response that is symmetrical around sample zero. The actual shape doesn't matter, only that the negative numbered samples are a mirror image of the positive numbered samples. When the Fourier transform is taken of thissymmetrical waveform, the phase will be entirely zero, as shown in (b).

The disadvantage of the zero phase filter is that it requires the use of negative indexes, which can be inconvenient to work with. The linear phase filter is a way around this. The impulse response in (d) is identical to that shown in (a), except it has been shifted to use only positive numbered samples. The impulse response is still symmetrical between the left and right; however, the location of symmetry has been shifted from zero. This shift results in the phase, (e), being a straight line, accounting for the name: linear phase. The slope of this straight line is directly proportional to the amount of the shift. Since the shift in the impulse response does nothing but produce an identical shift in the output signal, the linear phase filter is equivalent to the zero phase filter for most purposes.

Figure (g) shows an impulse response that is not symmetrical between the left and right.

Correspondingly, the phase, (h), is not a straight line. In other words, it has a nonlinear phase. Don't confuse the terms: nonlinear and linear phase with the concept of system linearity discussed in Chapter 5. Although both use the word linear, they are not related.

Correspondentemente, a fase, (h), no uma linha recta. Em outras palavras, tem uma fase de no-linear. No confunda os termos: fase no-linear e linear com o conceito de linearidade do sistema discutido no Captulo 5. Embora tanto o uso da palavra linear, eles no so relacionados. Por que algum se importa se a fase linear ou no? Figuras (c), (f) e (i) mostrar a resposta. Estas so as respostas de impulsos de cada um dos trs filtros. A resposta de pulso nada mais do que uma resposta passo positivo vai seguido de uma resposta negativa passo em frente. A resposta do pulso usado aqui porque ele mostra o que acontece nas bordas subindo e descendo em um sinal. Aqui est a parte mais importante: filtros de fase linear zero e ter margens esquerda e direita que tm a mesma aparncia, enquanto filtros de fase no-lineares tm margens esquerda e direita que parecem diferentes. Muitos aplicativos no podem tolerar as margens esquerda e direita que procuram diferente. Um exemplo a tela de um osciloscpio, onde essa diferena poderia ser interpretado como uma caracterstica do sinal a ser medido. Outro exemplo no processamento de vdeo. Voc pode imaginar ligar o seu televisor para encontrar a orelha esquerda de seu ator favorito olhando diferente de sua orelha direita? fcil de fazer um FIR (resposta de impulso finito) filtro tm uma fase linear. Isto porque a resposta ao impulso (kernel filtro) est directamente especificado no processo de concepo. Fazendo o kernel do filtro tem simetria esquerda-direita tudo o que necessrio. Este no o caso com IIR (recursiva) filtros, uma vez que os coeficientes de recurso so o que especificado, e no a resposta ao impulso. A resposta de impulso de um filtro recursivo no simtrico entre a esquerda e direita, e tem, portanto, uma fase no-linear. Circuitos eletrnicos analgicos tm esse mesmo problema com a resposta de fase. Imagine um circuito composto de resistores e

Why does anyone care if the phase is linear or not? Figures (c), (f), and (i) show the answer. These are the pulse responses of each of the three filters. The pulse response is nothing more than a positive going step response followed by a negative going step response. The pulse response is used here because it displays what happens to both the rising and falling edges in a signal. Here is the important part: zero and linear phase filters have left and right edges that look the same, while nonlinear phase filters have left and right edges that look different. Many applications cannot tolerate the left and right edges looking different. One example is the display of an oscilloscope, where this difference could be misinterpreted as a feature of the signal being measured. Another example is in video processing. Can you imagine turning on your TV to find the left ear of your favorite actor looking different from his right ear?

It is easy to make an FIR (finite impulse response) filter have a linear phase. This is because the impulse response (filter kernel) is directly specified in the design process. Making the filter kernel have left-right symmetry is all that is required. This is not the case with IIR (recursive) filters, since the recursion coefficients are what is specified, not the impulse response. The impulse response of a recursive filter is not symmetrical between the left and right, and therefore has a nonlinear phase.

Analog electronic circuits have this same problem with the phase response. Imagine a circuit composed of resistors and capacitors

sitting on your desk. If the input has always been zero, the output will also have always been zero. When an impulse is applied to the input, the capacitors quickly charge to some value and then begin to exponentially decay through the resistors. The impulse response (i.e., the output signal) is a combination of these various decaying exponentials. The impulse response cannot be symmetrical, because the output was zero before the impulse, and the exponential decay never quite reaches a value of zero again. Analog filter designers attack this problem with the Bessel filter, presented in Chapter 3. The Bessel filter is designed to have as linear phase as possible; however, it is far below the performance of digital filters. The ability to provide an exact linear phase is a clear advantage of digital filters.

capacitores sentado em sua mesa. Se a entrada tem sido sempre zero, a sada tambm tm sido sempre zero. Quando um impulso aplicado entrada, os condensadores carregar rapidamente para algum valor e, em seguida, comeam a decair exponencialmente atravs das resistncias. A resposta de impulso (ou seja, o sinal de sada) uma combinao destes vrios exponenciais em decomposio. A resposta de impulso no pode ser simtrica, porque a sada foi igual a zero antes do impulso, e do decaimento exponencial nunca alcana um valor de zero novamente. Analgicas designers filtro atacar este problema com o filtro de Bessel, apresentado no Captulo 3. O filtro de Bessel concebido para ter como fase linear quanto possvel, no entanto, bem abaixo do desempenho dos filtros digitais. A capacidade de fornecer uma fase exacta linear uma clara vantagem de filtros digitais. Felizmente, existe uma maneira simples para modificar filtros recursivos para se obter uma fase zero. Figura 19-8 mostra um exemplo de como isso funciona. O sinal de entrada a ser filtrada mostrado em (a). A Figura (b) mostra o sinal depois de ter sido filtrada por um nico mastro de filtro passa-baixo. Uma vez que este um filtro de fase no-linear, as extremidades esquerda e direita no tm a mesma aparncia, eles so verses invertidos um do outro. Como descrito anteriormente, este filtro recursivo implementado por exemplo a partir de 0 e de trabalho para amostra 150, calculando cada amostra ao longo do caminho. Agora, suponha que em vez de mover a partir de amostra 0 para amostra 150, que comeam em amostra de 150 e se mover em direo amostra 0. Em outras palavras, cada amostra no sinal de sada calculado a partir de amostras de entrada e sada para a direita da amostra a ser trabalhado. Isto significa que a equao de recurso, Eq. 19-1, alterada para:

Fortunately, there is a simple way to modify recursive filters to obtain a zero phase. Figure 19-8 shows an example of how this works. The input signal to be filtered is shown in (a). Figure (b) shows the signal after it has been filtered by a single pole low-pass filter. Since this is a nonlinear phase filter, the left and right edges do not look the same; they are inverted versions of each other. As previously described, this recursive filter is implemented by starting at sample 0 and working toward sample 150, calculating each sample along the way.

Now, suppose that instead of moving from sample 0 toward sample 150, we start at sample 150 and move toward sample 0. In other words, each sample in the output signal is calculated from input and output samples to the right of the sample being worked on. This means that the recursion equation, Eq. 19-1, is changed to:

EQUATION 19-9 The reverse recursion equation. This is the A equao recurso inversa. Esta a mesma

same as Eq. 19-1, except the signal is filtered from left-to-right, instead of right-to-left.

que a Eq.. 19-1, excepto o sinal filtrado a partir da esquerda para a direita, em vez da direita para a esquerda. A Figura (c) mostra o resultado desta filtragem inversa. Isto anlogo ao passar um sinal analgico atravs de um circuito RC electrnico, enquanto tempo de corrida para trs. ! esrevinu eht pu-wercs nac lasrever emitem-noituaC Filtragem no sentido inverso no produz qualquer benefcio em si, o sinal filtrado ainda tem margens esquerda e direita que no se parecem. A mgica acontece quando a filtragem de frente e verso so combinados. A Figura (d) os resultados de filtragem do sinal na direco para a frente e, em seguida, filtragem novamente na direco inversa. Voila! Isto produz um filtro de fase zero recursiva. Na verdade, qualquer filtro recursivo pode ser convertido em fase zero com esta tcnica bidireccional de filtragem. A pena s para este melhor desempenho um fator de dois em tempo de execuo e complexidade do programa. Como voc encontrar o impulso e respostas em freqncia do filtro global? A magnitude da resposta de frequncia a mesma para cada direco, enquanto que as fases so de sinal oposto. Quando as duas direces so combinados, a magnitude torna-se ao quadrado, enquanto que a fase cancela a zero. No domnio do tempo, isto corresponde a convoluo da resposta ao impulso original com uma verso da esquerda para a direita invertida de si mesma. Por exemplo, a resposta ao impulso de um nico plo filtro passabaixo um exponencial de um lado. A resposta de impulso do filtro correspondente bidireccional um exponencial de um lado que decai para a direita, convolved com um exponencial de um lado que decai para a esquerda. Atravessando os matemtica, este passa a ser uma exponencial de dupla face que decai tanto para a esquerda e direita, com a mesma constante de decaimento como o filtro original.

Figure (c) shows the result of this reverse filtering. This is analogous to passing an analog signal through an electronic RC circuit while running time backwards. !esrevinu eht pu-wercs nac lasrever emit -noituaC

Filtering in the reverse direction does not produce any benefit in itself; the filtered signal still has left and right edges that do not look alike. The magic happens when forward and reverse filtering are combined. Figure (d) results from filtering the signal in the forward direction and then filtering again in the reverse direction. Voila! This produces a zero phase recursive filter. In fact, any recursive filter can be converted to zero phase with this bidirectional filtering technique. The only penalty for this improved performance is a factor of two in execution time and program complexity.

How do you find the impulse and frequency responses of the overall filter? The magnitude of the frequency response is the same for each direction, while the phases are opposite in sign. When the two directions are combined, the magnitude becomes squared, while the phase cancels to zero. In the time domain, this corresponds to convolving the original impulse response with a left-for-right flipped version of itself. For instance, the impulse response of a single pole low-pass filter is a one-sided exponential. The impulse response of the corresponding bidirectional filter is a one-sided exponential that decays to the right, convolved with a one-sided exponential that decays to the left. Going through the mathematics, this turns out to be a doublesided exponential that decays both to the left and right, with the same decay constant as the original filter.

Some applications only have a portion of the signal in the computer at a particular time, such as systems that alternately input and output data on a continuing basis. Bidirectional filtering can be used in these cases by combining it with the overlap-add method described in the last chapter. When you come to the question of how long the impulse response is, don't say "infinite." If you do, you will need to pad each signal segment with an infinite number of zeros. Remember, the impulse response can be truncated when it has decayed below the round-off noise level, i.e., about 15 to 20 time constants. Each segment will need to be padded with zeros on both the left and right to allow for the expansion during the bidirectional filtering.

Algumas aplicaes tm apenas uma poro do sinal no computador num determinado momento, tais como sistemas de que os dados de entrada e sada alternadamente, numa base contnua. Filtragem bidireccionais pode ser usado nestes casos, combinando-a com o mtodo de sobreposio-add descrito no captulo anterior. Quando voc vem para a questo de quanto tempo a resposta ao impulso , no diga "infinito". Se fizer isso, voc precisar preencher cada segmento de sinal com um nmero infinito de zeros. Recordar, a resposta ao impulso pode ser truncado quando se tenha decomposto abaixo do nvel de rudo de arredondamento, isto , aproximadamente 15 a 20 constantes de tempo. Cada segmento ter de ser preenchido com zeros em ambos os lados esquerdo e direito para permitir a expanso durante a filtragem bidireccionais. usando Inteiros Ponto flutuante de preciso simples ideal para implementar esses filtros simples recursivas. O uso de nmeros inteiros possvel, mas muito mais difcil. H dois problemas principais. Primeiro, o erro de arredondamento a partir do nmero limitado de bits pode degradar a resposta do filtro, ou mesmo tornar instvel. Segundo, os valores das fraes dos coeficientes de recurso deve ser tratado com matemtica inteiro. Uma maneira para atacar este problema consiste em expressar cada coeficiente como uma fraco. Por exemplo, torna-se 0,15 19/128. Em vez de multiplicar por 0,15, primeiro voc multiplicar por 19 e depois dividir por 128. Outra maneira substituir as multiplicaes com olhar-up tabelas. Por exemplo, um 12 bits ADC produz amostras com um valor entre 0 e 4095. Em vez de multiplicar cada amostra de 0,15, voc passa as amostras atravs de uma tabela lookup que de 4096 entradas longo. O valor obtido a partir da tabela de consulta igual a 0,15 vezes o valor de entrar na tabela de consulta. Este mtodo muito rpido, mas requer memria extra; uma tabela look-up separada necessria para cada coeficiente. Antes de tentar qualquer um desses mtodos

Using Integers Single precision floating point is ideal to implement these simple recursive filters. The use of integers is possible, but it is much more difficult. There are two main problems. First, the round-off error from the limited number of bits can degrade the response of the filter, or even make it unstable. Second, the fractional values of the recursion coefficients must be handled with integer math. One way to attack this problem is to express each coefficient as a fraction. For example, 0.15 becomes 19/128. Instead of multiplying by 0.15, you first multiply by 19 and then divide by 128. Another way is to replace the multiplications with look-up tables. For example, a 12 bit ADC produces samples with a value between 0 and 4095. Instead of multiplying each sample by 0.15, you pass the samples through a look-up table that is 4096 entries long. The value obtained from the look-up table is equal to 0.15 times the value entering the look-up table. This method is very fast, but it does require extra memory; a separate look-up table is needed for each coefficient. Before you try either of these integer methods, make sure the recursive algorithm for the moving average filter will not suit your needs. It loves integers.

inteiros, certifique-se o algoritmo recursivo para o filtro de mdia mvel no ir atender as suas necessidades. Ela adora inteiros. FIGURE 19-1 Recursive filter notation. The output sample being calculated, y[n] , is determined by the values from the input signal, x[n], x[n& 1], x[n& 2], , as well as the previously calculated values in the output signal, y[n& 1], y[n& 2], y[n& 3], . These figures are shown for n ' 28 . Notao filtro recursivo. A amostra de sada a ser calculados, y [n], determinado pelos valores do sinal de entrada, X [N], x [n e 1], X [n e 2], Th, bem como os valores previamente calculados na sada sinal, y [n & 1], y [n & 2], y [n & 3], . Estes nmeros so mostrados para n '28. FIGURE 19-2 Single pole low-pass filter. Digital recursive filters can mimic analog filters composed of resistors and capacitors. As shown in this example, a single pole low-pass recursive filter smoothes the edge of a step input, just as an electronic RC filter. nico plo filtro passa-baixa. Digital filtros recursivos podem imitar filtros analgicos, composto de resistores e capacitores. Como mostrado neste exemplo, um nico plo passabaixo do filtro recursivo suaviza a borda de uma entrada em degrau, tal como um filtro RC electrnico. FIGURE 19-3 Single pole high-pass filter. Proper coefficient selection can also make the recursive filter mimic an electronic RC high-pass filter. These single pole recursive filters can be used in DSP just as you would use RC circuits in analog electronics. Single plo filtro passa-alta. Coeficiente de seleo adequada pode tambm fazer o filtro recursivas imitar um eletrnico RC filtro passa-alta. Estes filtros nico plo recursivo pode ser usado em DSP, assim como voc poderia usar circuitos RC em eletrnica

analgica. FIGURE 19-4 Example of single pole recursive filters. In (a), a high frequency burst rides on a slowly varying signal. In (b), single pole low-pass and high-pass filters are used to separate the two components. The low-pass filter uses x = 0.95, while the high-pass filter is for x = 0.86. Exemplo de filtros nico plo recursivo. Em (a), uma alta frequncia rebentar passeios em um sinal de variao lenta. Em (b), os filtros de plo nico passa-baixo e passa-alto so usados para separar os dois componentes. As utilizaes filtro passa-baixa x = 0,95, enquanto que o filtro passa-alto para x = 0,86. FIGURE 19-5 Single pole frequency responses. Figures (a) and (b) show the frequency responses of highpass and low-pass single pole recursive filters,respectively. Figure (c) shows the frequency response of a cascade of four lowpass filters. The frequency response of recursive filters is not always what you expect, especially if the filter is pushed to extreme limits. For example, the fC ' 0.25 curve in (c) is quite useless. Many factors are to blame, including: aliasing, roundoff noise, and the nonlinear phase response. Respostas de frequncia nica pole. Figuras (a) e (b) mostram as respostas em freqncia de highpass e filtros low-pass nico plo recursivo, respectivamente. A Figura (c) mostra a resposta de frequncia de uma cascata de quatro filtros passa-baixa. A resposta em frequncia de filtros recursivos no sempre que voc espera, especialmente se o filtro empurrado para os limites extremos. Por exemplo, a curva de fc '0,25 em (c) bastante intil. Muitos fatores so os culpados, incluindo: aliasing, rudo de arredondamento, ea resposta de fase nolinear. FIGURE 19-6

Characteristics of narrow-band filters. Figure (a) and (b) shows the frequency responses of various band-pass and band-reject filters. The step response of the band-reject filter is shown in (c). The band-reject (notch) filter is useful for removing 60 Hz and similar interference from time domain encoded waveforms. Caractersticas dos filtros de banda estreita. A Figura (a) e (b) mostra as respostas de frequncia de vrios filtros passa-banda e de banda rejeitar. A resposta passo do filtro de banda-rejeitar mostrado em (c). A bandarejeitar (entalhe) filtro til para a remoo de 60 Hz e interferncia semelhante a partir de domnio de tempo codificados formas de onda. FIGURE 19-7 Zero, linear, and nonlinear phase filters. A zero phase filter has an impulse response that has left-right symmetry around sample number zero, as in (a). This results in a frequency response that has a phase composed entirely of zeros, as in (b). Zero phase impulse responses are desirable because their step responses are symmetrical between the top and bottom, making the left and right edges of pulses look the same, as is shown in (c). Linear phase filters have left-right symmetry, but not around sample zero, as illustrated in (d). This results in a phase that is linear, that is, a straight line, as shown in (e). The linear phase pulse response, shown in (f), has all the advantages of the zero phase pulse response. In comparison, the impulse responses of nonlinear phase filters are not symmetrical between the left and right, as in (g), and the phases are not a straight line, as in (h). The worst part is that the left and right edges of the pulse response are not the same, as shown in (i). Zero, lineares, e no-linear filtros de fase. Um filtro de fase zero tem uma resposta de impulso que tem esquerda-direita simetria em torno nmero da amostra zero, como em (a). Isto resulta numa resposta de frequncia que tem uma fase composta inteiramente de zeros, como em (b). Zero respostas de impulsos de fase so desejveis porque as suas respostas passo so simtricas entre a parte superior e

inferior, tornando as extremidades esquerda e direita de pulsos a mesma aparncia, como mostrado em (c). Filtros de fase linear tem esquerda-direita simetria, mas no em torno da amostra zero, como ilustrado em (d). Isto resulta em uma fase que linear, isto , uma linha recta, como mostrado em (e). A resposta de impulso linear de fase, mostrado em (f), tem todas as vantagens da resposta ao zero fase de pulso. Em comparao, as respostas de impulso de filtros de fase no-lineares no so simtricas entre a esquerda e para a direita, como em (g), e as fases no so uma linha recta, como em (h). O pior que as extremidades esquerda e direita da resposta de impulso no so os mesmos, como mostrado em (i). FIGURE 19-8 Bidirectional recursive filtering. A rectangular pulse input signal is shown in (a). Figure (b) shows the signal after being filtered with a single pole recursive low-pass filter, passing from left-to-right. In (c), the signal has been processed in the same manner, except with the filter moving right-to-left. Figure (d) shows the signal after being filtered both left-to-right and then right-to-left. Any recursive filter can be made zero phase by using this technique. Bidirecionais filtragem recursiva. Um sinal de entrada rectangular de pulso mostrado em (a). A Figura (b) mostra o sinal depois de ser filtrado com um nico plo filtro passa-baixo recursiva, passando a partir da esquerda para a direita. Em (c), o sinal foi processada da mesma maneira, excepto com o filtro de movimento da direita para a esquerda. A Figura (d) mostra o sinal depois de ser filtrado, tanto da esquerda para a direita e, em seguida, da direita para a esquerda. Qualquer filtro recursivo pode ser feita fase zero usando esta tcnica.

Vous aimerez peut-être aussi