An Fir-Filter Example: Hanning Filter

Similar documents
An Iir-Filter Example: A Butterworth Filter

Lecture 19 IIR Filters

DSP Configurations. responded with: thus the system function for this filter would be

Ch. 7: Z-transform Reading

Discrete-Time Systems

Transform analysis of LTI systems Oppenheim and Schafer, Second edition pp For LTI systems we can write

ECE4270 Fundamentals of DSP Lecture 20. Fixed-Point Arithmetic in FIR and IIR Filters (part I) Overview of Lecture. Overflow. FIR Digital Filter

From Wikipedia, the free encyclopedia

Detailed Solutions to Exercises

Signals and Systems. Problem Set: The z-transform and DT Fourier Transform

How to manipulate Frequencies in Discrete-time Domain? Two Main Approaches

LECTURE NOTES DIGITAL SIGNAL PROCESSING III B.TECH II SEMESTER (JNTUK R 13)

A.1 THE SAMPLED TIME DOMAIN AND THE Z TRANSFORM. 0 δ(t)dt = 1, (A.1) δ(t)dt =

VU Signal and Image Processing

DISCRETE-TIME SIGNAL PROCESSING

UNIT - III PART A. 2. Mention any two techniques for digitizing the transfer function of an analog filter?

z-transforms Definition of the z-transform Chapter


Discrete-time signals and systems

Let H(z) = P(z)/Q(z) be the system function of a rational form. Let us represent both P(z) and Q(z) as polynomials of z (not z -1 )

Lecture 2 OKAN UNIVERSITY FACULTY OF ENGINEERING AND ARCHITECTURE

Lecture 11 FIR Filters

Z-Transform. x (n) Sampler

Signals, Instruments, and Systems W5. Introduction to Signal Processing Sampling, Reconstruction, and Filters

Discrete-Time David Johns and Ken Martin University of Toronto

Review of Discrete-Time System

ELEG 305: Digital Signal Processing

EE 521: Instrumentation and Measurements

EE102B Signal Processing and Linear Systems II. Solutions to Problem Set Nine Spring Quarter

2. Typical Discrete-Time Systems All-Pass Systems (5.5) 2.2. Minimum-Phase Systems (5.6) 2.3. Generalized Linear-Phase Systems (5.

Need for transformation?

DSP Design Lecture 2. Fredrik Edman.

UNIVERSITY OF OSLO. Please make sure that your copy of the problem set is complete before you attempt to answer anything.

Discrete-Time Signals: Time-Domain Representation

A system that is both linear and time-invariant is called linear time-invariant (LTI).

Theory and Problems of Signals and Systems

y[n] = = h[k]x[n k] h[k]z n k k= 0 h[k]z k ) = H(z)z n h[k]z h (7.1)

Discrete-Time Signals: Time-Domain Representation

Z Transform (Part - II)

Discrete Time Systems

IT DIGITAL SIGNAL PROCESSING (2013 regulation) UNIT-1 SIGNALS AND SYSTEMS PART-A

Transform Representation of Signals

E : Lecture 1 Introduction

SIGNALS AND SYSTEMS. Unit IV. Analysis of DT signals

On the Frequency-Domain Properties of Savitzky-Golay Filters

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF INFORMATION TECHNOLOGY. Academic Year

Discrete-Time Fourier Transform (DTFT)

The Laplace Transform

Signals and Systems: Introduction

Analysis of Finite Wordlength Effects

Lecture 5 - Assembly Programming(II), Intro to Digital Filters

Lecture 7 Discrete Systems

Recursive Gaussian filters

6.003: Signals and Systems

Discrete-Time Fourier Transform

Digital Signal Processing Lecture 8 - Filter Design - IIR

Generalizing the DTFT!

Comments on Hilbert Transform Based Signal Analysis

Use: Analysis of systems, simple convolution, shorthand for e jw, stability. Motivation easier to write. Or X(z) = Z {x(n)}

# FIR. [ ] = b k. # [ ]x[ n " k] [ ] = h k. x[ n] = Ae j" e j# ˆ n Complex exponential input. [ ]Ae j" e j ˆ. ˆ )Ae j# e j ˆ. y n. y n.

Very useful for designing and analyzing signal processing systems

Linear Convolution Using FFT

1 Introduction & Objective. 2 Warm-up. Lab P-16: PeZ - The z, n, and O! Domains

Topic 3: Fourier Series (FS)

The Laplace Transform

Digital Filters Ying Sun

Digital Signal Processing Lecture 10 - Discrete Fourier Transform

Discrete Time Systems

CMPT 889: Lecture 5 Filters

3 What You Should Know About Complex Numbers

Digital Filters. Linearity and Time Invariance. Linear Time-Invariant (LTI) Filters: CMPT 889: Lecture 5 Filters

Multimedia Signals and Systems - Audio and Video. Signal, Image, Video Processing Review-Introduction, MP3 and MPEG2

ELEG 305: Digital Signal Processing

ECE-S Introduction to Digital Signal Processing Lecture 4 Part A The Z-Transform and LTI Systems

Digital Filter Structures. Basic IIR Digital Filter Structures. of an LTI digital filter is given by the convolution sum or, by the linear constant

Digital Filter Implementation 1

Two-Dimensional Systems and Z-Transforms

LECTURE NOTES IN AUDIO ANALYSIS: PITCH ESTIMATION FOR DUMMIES

Notice the minus sign on the adder: it indicates that the lower input is subtracted rather than added.

Lecture 04: Discrete Frequency Domain Analysis (z-transform)

Algebra III/Trigonometry CP

Chap 2. Discrete-Time Signals and Systems

Module 4 : Laplace and Z Transform Problem Set 4

UNIT 1. SIGNALS AND SYSTEM

The Laplace Transform

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EC2314- DIGITAL SIGNAL PROCESSING UNIT I INTRODUCTION PART A

LECTURE 12 Sections Introduction to the Fourier series of periodic signals

Digital Signal Processing

Z-Transform. The Z-transform is the Discrete-Time counterpart of the Laplace Transform. Laplace : G(s) = g(t)e st dt. Z : G(z) =

Signal Processing First Lab 11: PeZ - The z, n, and ˆω Domains

University of Illinois at Urbana-Champaign ECE 310: Digital Signal Processing

Like bilateral Laplace transforms, ROC must be used to determine a unique inverse z-transform.

Chapter 7: Filter Design 7.1 Practical Filter Terminology

EE 3054: Signals, Systems, and Transforms Spring A causal discrete-time LTI system is described by the equation. y(n) = 1 4.

Z-TRANSFORMS. Solution: Using the definition (5.1.2), we find: for case (b). y(n)= h(n) x(n) Y(z)= H(z)X(z) (convolution) (5.1.

Digital Filter Structures

8. z-domain Analysis of Discrete-Time Signals and Systems

Discrete-Time Signals and Systems. The z-transform and Its Application. The Direct z-transform. Region of Convergence. Reference: Sections

Problem Value

Butterworth Filter Properties

Transcription:

An Fir-Filter Example: Hanning Filter Josef Goette Bern University of Applied Sciences, Biel Institute of Human Centered Engineering - microlab Josef.Goette@bfh.ch February 7, 2018 Contents 1 Mathematical Descriptions 1 1.1 Transfer Function.................. 2 1.2 Frequency Response................ 3 1.3 Poles and Zeros................... 8 2 Signal Flow Graphs 10 2.1 Direct Form..................... 11 2.2 Transposed Form.................. 12 2.3 Cascade Form.................... 13 References 14 31 Fir Hanning i 2018

c Josef Goette, 2007 2018 All rights reserved. This work may not be translated or copied in whole or in part without the written permission by the author, except for brief excerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage and retrieval, electronic adaptation, computer software is forbidden. 31 Fir Hanning ii 2018

1 Mathematical Descriptions The filter might be described in the time domain as well as in transformation domains. Whereas the difference equation in the time domain is the natural description, which is most often used in implementations, the transformation domain descriptions are useful for the purpose of analysis and synthesis of the filter. As transformation-domain descriptions we use the domain of the z-transform leading to the transfer function, and the frequencydomain description leading to the frequency response. Time- and Transform-Domain Descriptions difference equation y[n] = 1 4 ( ) x[n] + 2x[n 1] + x[n 2] transfer function H(z) = 1 4 (1 + 2z 1 + z 2) frequency response H(ˆω) = H ( z = e jˆω) = 1 2 magnitude, phase ( ) 1 + cos(ˆω) e jˆω 31 Fir Hanning 1 2018

1.1 Transfer Function The z-transform transforms a discrete-time signal x[n] a sequence of numbers into the representation through a complexvalued function X( ) of the complex variable z, X(z). 1 For a given discrete-time signal x[n], its z-transform is defined by 2 x[n] X(z) = n= x[n]z n. To obtain the transfer function of the Hanning filter, we start with its specifying difference-equation and use the Ansatz x[n] X(z), y[n] Y (z), that is, we argue that, whatever are the signals input to and output from the filter, x[n] and y[n], respectively, there exist z-transform representations for them. 1 The complex variable z gives the name to the transformation. The z- transform is closely related to the characteristic function often used probability theory and statistics. 2 We use here the so-called bilateral z-transform that is most often applied in signal processing with its stationary problems; signals are always present, they extend from to +. There exists another z-transform, the unilateral z-transform, that is most often applied in control with its transient problems; signals start at zero and extend only to +. Problems treated in control are initial value problems. Note that there are some subtle differences in the properties of these two z-transforms; especially, the left-shift theorem involves in the unilateral z-transform the initial values of the signal or the system, whereas the bilateral z-transform does not. For a good and nevertheless short introduction to the bilateral z-transform you might want to study [MSY98, Chapter 7]; for a more in-depth treatment, discussing also the differences between unilateral and bilateral z-transform, you might consult [OWN97] or any newer edition of this text. 31 Fir Hanning 2 2018

Next, we use the shift property of the z-transform stating that x[n] X(z) = x[n 1] z 1 X(z). Finally, using the linearity property of the z-transform, we may transform the given difference equation into the z domain: ( ) X(z) + 2z 1 X(z) + z 2 X(z) Y (z) = 1 4 = 1 4 ( 1 + 2z 1 + z 2) X(z). The transfer function is defined as the ratio of output signal to input signal in the z-domain description, H(z) ˆ= Y (z)/x(z); we thus obtain transfer function ˆ= H(z) ˆ= Y (z) X(z) = 1 ( 1 + 2z 1 + z 2). 4 1.2 Frequency Response The frequency response of a (linear) system is the response of the system here the Hanning filter to a sinusoidal input signal, taken as a function of the frequency of the input sinusoid. Such a definition makes sense if the system is a linear system, which reacts to a sinusoidal input with a sinusoidal output of the same frequency; 3 what the linear system does to the input sinusoidal signal is that it changes its amplitude and its phase, and this amplitude- and phase change is described by the frequency response. Consider a discrete-time sinusoidal signal a sequence, that might be the input to the considered system, x[n] = cos ( nˆω 0 + φ ), 3 Note that the input sinusoidal signal is taken to exist over the complete time axis < n <. 31 Fir Hanning 3 2018

where ˆω 0 is the discrete-time radian frequency, which is in the interval 0 ˆω 0 π, and where φ is its phase. Using Euler s formula, we can express this sinusoidal signal as x[n] = cos ( nˆω 0 + φ ), = 1 (e j(nˆω0+φ) + e j(nˆω0+φ)) 2 = 1 ( e jnˆω0 e jφ + e jnˆω0 e jφ), 2 that is, the sinusoidal signal is the sum of two basic complex exponential components. Because the considered systems are linear systems, for which superposition holds, it is sufficient to consider only complex exponentials as input signals the response to the initially considered sinusoidal signal can then be obtained by superposition of the responses to the complex exponential inputs. 4 Thus, the complex exponentials are the basic building blocks, and we continue to analyze what happens at the output of a linear system if we apply at the input signals of the form 5 x[n] = Ae jφ e jnˆω0, < n. (1) To compute the output of our Hanning filter if we apply at its input the complex exponential signal from (1), we just insert 4 The superposition principle holding for linear systems is the reason that the frequency response completely describes this kind of systems, that is, given the frequency response we may compute the output signal of the system for any given input signal: Due to the Fourier theory, any signal any practically relevant signal can be described by its Fourier series (or by its Fourier transform, if needed); we know for each component sinusoidal signal of this Fourier series its response at the output of the considered system; because the system is linear, a linear combination at the system s input the Fourier series leads to a corresponding linear combination at the system s output (this is the superposition principle). 5 We use now radian frequencies in the interval π ˆω 0 π. 31 Fir Hanning 4 2018

this input signal x[n] into the difference equation describing the Hanning filter; we obtain y[n] = 1 ( ) x[n] + 2x[n 1] + x[n 2] 4 = 1 ) (Ae jφ e jnˆω0 + 2Ae jφ e j(n 1)ˆω0 + Ae jφ e j(n 2)ˆω0 4 = 1 ) (1 + 2e jˆω0 + e j2ˆω0 } 4 } Ae jφ {{ e jnˆω0 }. (2) {{} input x[n] ˆ= H(ˆω 0 ) The expression termed H(ˆω 0 ) in the above equation is independent of time n and is only dependent on the system to be described; it is the frequency response of the Hanning filter. We immediately see that H(ˆω 0 ) = H ( z = e jˆω0 ), that is, we obtain the frequency response H( ) by evaluating the transfer function H( ) on the unit circle. 6 From formula (2) we indeed see that the complex exponential signal x[n] = Ae jφ e jnˆω0 at the input to the linear filter re-appears at its output, but it is changed by the complex amplitude H(ˆω 0 ), which depends on the input frequency ˆω 0. By the mentioned superposition argument we see, in turn, that for the linear filter we indeed have sinus in = sinus with identical frequency out. To more easily see the amplitude- and phase change the frequency response H(ˆω) imposes to an input sinusoidal signal with a certain frequency ˆω, we next express H(ˆω) as the product of 6 The input variable z to the transfer function H( ) is a complex variable; therefore, its domain is the complex plane which we call the z plane. The values z = e jˆω for π ˆω π define a circle with center at the origin and with radius one in the z plane. 31 Fir Hanning 5 2018

a real-valued function and a complex exponential function: H(ˆω) = 1 4 (1 + 2e jˆω + e j2ˆω) = 1 4 e jˆω( e +jˆω + 2 + e jˆω) = 1 2 ( ) 1 + cos(ˆω) e jˆω = R(ˆω) e jˆω, where we have, to obtain the second but last equality, again used Euler s formula. 7 We now see that the real-valued function R(ˆω) contributes to the amplitude- as well as to the phase change that an input sinusoidal signal undergoes by passing the filter, 8 and that the complex exponential function only contributes to the phase change. Moreover, we see that this phase change is, for the considered Hanning filter, just ˆω, that is, the Hanning filter has a linear phase. We finally note that any Fir filter having a symmetric sequence of coefficients in its describing difference equation will have a linear phase as the Hanning filter has. With symmetric sequence of coefficients we mean that the first coefficient is equal to the last, the second coefficient is equal to the second but last, and so on. Likewise, any Fir filter having an anti-symmetric sequence of coefficients in its describing difference equation will also have such a linear phase. We mean with anti-symmetric sequence of coefficients that the first coefficient is equal to the negative of the last, the second coefficient is equal to the negative of the second but last, and so on. In 7 Here we have used Euler s formula in inverse direction, e jϕ +e jϕ = 2cos(ϕ). 8 Because the real-valued function obtained for the presently considered Hanning filter, R(ˆω) = (1 + cos(ˆω))/2, is always non-negative, it only contributes to the amplitude change. In general, R(ˆω) might become negative at a certain frequency, indicating there a phase jump of ±π. 31 Fir Hanning 6 2018

the anti-symmetric case, the cos terms in R(ˆω) are replaced by sin terms; also note in this context that the imaginary unit j might be written as j = e jπ/2, an equality that might become useful if we sketch amplitude- and phase responses by hand. Magnitude- and Phase-Response 4 Magnitude of FIR Filter with Coefficients {1,2,1} 3 magnitude 2 1 0 π 0 discrete radian frequency π π Phase of FIR Filter with Coefficients {1,2,1} phase 0 π π 0 discrete radian frequency π 31 Fir Hanning 7 2018

1.3 Poles and Zeros The transfer function H(z) = (1 + 2z 1 + z 2 )/4 can be expressed in the following different forms: H(z) = 1 4 = 1 4 ( 1 + 2z 1 + z 2) (3) ( 1 + z 1)( 1 + z 1). (4) If we multiply by 1 = z 2 /z 2 we obtain two further equivalent forms H(z) = 1 4 = 1 4 z 2 + 2z + 1 z 2 (5) z + 1 z z + 1 z. (6) The factored form (6) clearly shows that the z-value z = 1 makes the transfer function zero: H(z = 1) 0. That value of z is called a zero of the transfer function; indeed, we even have a double zero at z = 1 because the factor z + 1 appears twice in (6). Equation (6) also shows that H(z) for z 0. Values of z for which the transfer function H(z) is undefined (infinite) are called the poles of H(z). In the present case we see that the term z 2 in the denominator of (5) represents two poles at z = 0, or, expressed differently, that H(z) has a double pole (a second-order pole) at z = 0. We see that the transfer function H(z) expressed in form (3) is a polynomial in z 1. Such a polynomial transfer-function form not just happens for the presently considered Hanning filter, but any Fir filter will have a polynomial transfer function. By 31 Fir Hanning 8 2018

generalizing the above argumentation, we see than that any Fir filter will have only poles at the origin z = 0. Because poles of a filter (of a system) are responsible for its stability, and because a discrete-time filter is stable if and only if all its poles lie strictly inside of the unit circle in the z-plane, we see that any Fir filter is always stable. This finding is, of course, not a surprise, because the computations involved in computing a Fir filter s output sample only use samples of the input signal but no previously computed output samples, that is, there are only feed-forward computations but no feed-back computations. Pole-Zero Plot in the Complex z-plane The Complex z Plane (1 + 2z 1 + z 2) 1 H(z) = 1 4 0.5 = 1 4 = 1 4 (1 + z 1)( 1 + z 1) z + 1 z z + 1 z Imaginary Part 0 0.5 1 2 2 unit circle 1 0.5 0 0.5 1 Real Part Note that the locations of both, the poles and the zeros, are also clear when H(z) is written in the form (4): Each factor of the form (1 az 1 ) in the presently considered situation a = 1 can always be expressed as (1 az 1 ) = (z a) z. 31 Fir Hanning 9 2018

2 Signal Flow Graphs Recall the definition of our Hanning filter in the time domain, see page 1. Omitting here for simplicity the scaling factor 1/4, we have ( ) y[n] = x[n] + 2x[n 1] + x[n 2]. (7) We obviously see that to compute the output sample at time n, y[n], we need the following: First, a means for multiplying (possibly delayed) input-signal values x[ ] by the filter coefficients, which happen to be here {1, 2, 1}; second, a means for adding the scaled (multiplied) input-signal values; and third, a means for obtaining delayed versions of the input-signal samples. It is useful to represent the operations of (7) as a block diagram a so-called signal-flow graph or dynamic diagram. Such representations may lead to better insight about the properties of the system and about alternative ways to implement it. From the discussion above it is clear that the building blocks for dynamic diagrams for signal-flow graphs are multiplier, adder, and unit delay. Thereby, the multiplier is special in that one operand is constant the filter coefficient 9 and only the other operand changes the signal sample; the complete adder is usually realized by several two-input adders; and the unit delay is an element whose hardware implementation performs acquiring a sample value, storing it in memory for one clock cycle, and then releasing it to the output. Delays by more than one time unit are implemented (from a dynamic diagram point 9 In the presently considered Fir filters, the coefficients are constants; in the later considered adaptive filters, which often base on Fir filter structures, these coefficients are no longer constants (which are, in the simple Fir filter case, once determined at the design-phase of the filter), but, instead, are coefficients that change adapt during system operation. 31 Fir Hanning 10 2018

of view) by a cascade of several unit delays. An M-unit delay thus requires M memory cells configured as a shift register; in a computer memory, such a shift register may be implemented as a circular buffer. 10 2.1 Direct Form The most simple block diagram of the Hanning filter (7) is the so-called direct form. It computes the output sample y[n] by ( ) y[n] = x[n 2] + 2x[n 1] + x[n]. Direct-Form Block Diagram of Hanning Filter x[n] z 1 x[n 1] z 1 x[n 2] 2 + + y[n] 10 In a shift register, the register contents the data are moved (shifted); in a circular buffer, the register contents remain in place, but the pointer addressing them is moved. 31 Fir Hanning 11 2018

2.2 Transposed Form Obviously, we may compute differently as compared to the direct form. For example, computing as ( ) y[n] = x[n] + 2x[n 1] + x[n 2] leads to the transposed form. Indeed, using the internal signal names in the block diagram below, we have y[n] = x[n] + v 1 [n 1], v 1 [n] = 2x[n] + v 2 [n 1] = x[n] + 2x[n 1] + v 2 [n 2], v 2 [n] = x[n] = x[n] + 2x[n 1] + x[n 2]. Transposed-Form Block Diagram of Hanning Filter x[n] 2 z 1 + z 1 + v 2 [n] v 1 [n] y[n] 31 Fir Hanning 12 2018

2.3 Cascade Form Still another form of block diagram might be obtained if we start from the factored transfer function in (4); again omitting the scaling factor 1/4, we have the cascade of two systems with transfer function ( 1 + z 1) each. Because ( 1 + z 1) corresponds to the difference equation y[n] = x[n] + x[n 1] for an input sequence x[n] and corresponding output sequence y[n], we have for the complete Hanning filter the block diagram below. Cascade-Form Block Diagram of Hanning Filter x[n] z 1 x[n 1] + y 1[n] z 1 y 1 [n 1] + y[n] 31 Fir Hanning 13 2018

We finally note that in general many block diagrams implement the same Fir filter in the sense that the externally seen behavior from input to output will be the same; the discussed direct form, transposed form, and cascade form are just examples. Different block diagrams represent different internal computations or different orders of computation. Therefore, different block diagrams that implement the same input-output characteristic may have very different characteristics concerning there internal behavior. Especially, finite word-length effects are important if the filter is implemented in fixed-point arithmetic, where round-off noise and over- and underflow are important real-world problems which depend on the internal order of computation. References [MSY98] James H. McClellan, Ronald W. Schafer, and Mark A. Yoder. Dsp First: A Multimedia Approach. Prentice-Hall Inc., 1998. [OWN97] Alan V. Oppenheim, Alan S. Willsky, and S. Hamid Nawab. Signals and Systems. Prentice-Hall Inc., Englewood Cliffs, N.J., 2nd edition, 1997. 31 Fir Hanning 14 2018