butter butter Purpose Syntax Description Digital Domain Analog Domain

Similar documents
SIGNALS AND SYSTEMS LABORATORY 4: Polynomials, Laplace Transforms and Analog Filters in MATLAB

INFINITE-IMPULSE RESPONSE DIGITAL FILTERS Classical analog filters and their conversion to digital filters 4. THE BUTTERWORTH ANALOG FILTER

APPLIED SIGNAL PROCESSING

3. Array and Matrix Operations

EE482: Digital Signal Processing Applications

DIGITAL SIGNAL PROCESSING UNIT III INFINITE IMPULSE RESPONSE DIGITAL FILTERS. 3.6 Design of Digital Filter using Digital to Digital

Filter Analysis and Design

INFE 5201 SIGNALS AND SYSTEMS

Discrete-Time Systems

w n = c k v n k (1.226) w n = c k v n k + d k w n k (1.227) Clearly non-recursive filters are a special case of recursive filters where M=0.

Chapter 7: IIR Filter Design Techniques

Digital Signal Processing

Digital Signal Processing Lecture 8 - Filter Design - IIR

On the Frequency-Domain Properties of Savitzky-Golay Filters

Signal Processing. Young Won Lim 2/20/18

ECE 410 DIGITAL SIGNAL PROCESSING D. Munson University of Illinois Chapter 12

Responses of Digital Filters Chapter Intended Learning Outcomes:

Filters and Tuned Amplifiers

Butterworth Filter Properties

Discrete-time first-order systems

EE Experiment 11 The Laplace Transform and Control System Characteristics

LINEAR-PHASE FIR FILTERS DESIGN

PS403 - Digital Signal processing

Chapter 7: Filter Design 7.1 Practical Filter Terminology

Filter structures ELEC-E5410

Design IIR Butterworth Filters Using 12 Lines of Code

Cast of Characters. Some Symbols, Functions, and Variables Used in the Book

Stability Condition in Terms of the Pole Locations

Time Series Analysis: 4. Linear filters. P. F. Góra

Quadrature-Mirror Filter Bank

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

MITOCW watch?v=jtj3v Rx7E

Digital Signal Processing 2/ Advanced Digital Signal Processing, Audio/Video Signal Processing Lecture 10, Frequency Warping, Example

Design of IIR filters

Signal Processing. Young Won Lim 2/22/18

Time Series Analysis: 4. Digital Linear Filters. P. F. Góra

Digital Signal Processing:

EE 521: Instrumentation and Measurements

Computer-Aided Design of Digital Filters. Digital Filters. Digital Filters. Digital Filters. Design of Equiripple Linear-Phase FIR Filters

ELEG 305: Digital Signal Processing

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

LAB 6: FIR Filter Design Summer 2011

Analog and Digital Filter Design

Discrete Time Systems

Digital Control & Digital Filters. Lectures 21 & 22

# 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.

Exercises in Digital Signal Processing

IIR digital filter design for low pass filter based on impulse invariance and bilinear transformation methods using butterworth analog filter

Electronic Circuits EE359A

DIGITAL SIGNAL PROCESSING. Chapter 6 IIR Filter Design

DSP-CIS. Chapter-4: FIR & IIR Filter Design. Marc Moonen

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

Digital Signal Processing Lab 4: Transfer Functions in the Z-domain

An Iir-Filter Example: A Butterworth Filter

Lecture 7 Discrete Systems

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

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

UNIVERSITY OF OSLO. Faculty of mathematics and natural sciences. Forslag til fasit, versjon-01: Problem 1 Signals and systems.

EECE 301 Signals & Systems Prof. Mark Fowler

Maximally Flat Lowpass Digital Differentiators

LABORATORY 3 FINITE IMPULSE RESPONSE FILTERS

The Approximation Problem

Digital Signal Processing Lecture 9 - Design of Digital Filters - FIR

Multirate Digital Signal Processing

UNIVERSITI SAINS MALAYSIA. EEE 512/4 Advanced Digital Signal and Image Processing

Digital Signal Processing

Basic Design Approaches

Tunable IIR Digital Filters

Lab 3 & 4. LTI Systems, the Z-Transform, and an Introduction

Fourier Series Representation of

E : Lecture 1 Introduction

Filter Design Problem

Convolution. Define a mathematical operation on discrete-time signals called convolution, represented by *. Given two discrete-time signals x 1, x 2,

MATLAB and Mathematical Introduction Will be discussed in class on 1/24/11

ECE 203 LAB 1 MATLAB CONTROLS AND SIMULINK

Lectures: Lumped element filters (also applies to low frequency filters) Stub Filters Stepped Impedance Filters Coupled Line Filters

INF3440/INF4440. Design of digital filters

Signal Processing. Young Won Lim 3/3/18

We have shown earlier that the 1st-order lowpass transfer function

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 )

DISCRETE-TIME SIGNAL PROCESSING

Time series analysis in neuroscience. Lecture 6. FIR and IIR filters

Signal Processing. Young Won Lim 2/24/18

Optimum Ordering and Pole-Zero Pairing of the Cascade Form IIR. Digital Filter

Electronic Circuits EE359A

1 1.27z z 2. 1 z H 2

REAL TIME DIGITAL SIGNAL PROCESSING

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

Laplace Transform Analysis of Signals and Systems

EE -213 BASIC CIRCUIT ANALYSIS LAB MANUAL

Digital Signal Processing IIR Filter Design via Bilinear Transform

Lecture 4: Matrices. Math 98, Spring Math 98, Spring 2018 Lecture 4: Matrices 1 / 20

Review of Fundamentals of Digital Signal Processing

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

LAB MANUAL. Department of Electrical & Electronics Engineering. University Institute of Engineering and Technology, Panjab University, Chandigarh

Lecture 19 IIR Filters

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

CMPT 889: Lecture 5 Filters

Ch. 7: Z-transform Reading

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

Transcription:

butter butter 7butter Butterworth analog and digital filter design [b,a] = butter(n,wn) [b,a] = butter(n,wn,'ftype') [b,a] = butter(n,wn,'s') [b,a] = butter(n,wn,'ftype','s') [z,p,k] = butter(...) [A,B,C,D] = butter(...) butter designs lowpass, bandpass, highpass, and bandstop digital and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that is maximally flat in the passband and monotonic overall. Butterworth filters sacrifice rolloff steepness for monotonicity in the pass- and stopbands. Unless the smoothness of the Butterworth filter is needed, an elliptic or Chebyshev filter can generally provide steeper rolloff characteristics with a lower filter order. Digital Domain [b,a] = butter(n,wn) designs an order n lowpass digital Butterworth filter with normalized cutoff frequency Wn. It returns the filter coefficients in length n+1 row vectors b and a, with coefficients in descending powers of z. H( z) B( z) b( 1) + b( 2)z ---------- 1 +! + b( n + 1)z = = ------------------------------------------------------------------------------------ n A( z) 1 + a( 2)z 1 +! + a( n + 1)z n Cutoff frequency is that frequency where the magnitude response of the filter is 1 2. For butter, the normalized cutoff frequency Wn must be a number between 0 and 1, where 1 corresponds to the Nyquist frequency, π radians per sample. If Wn is a two-element vector, Wn = [w1 w2], butter returns an order 2*n digital bandpass filter with passband w1 < ω < w2. [b,a] = butter(n,wn,'ftype') designs a highpass, lowpass, or bandstop filter, where the string 'ftype' is one of the following. 'high' for a highpass digital filter with normalized cutoff frequency Wn 'low' for a lowpass digital filter with normalized cutoff frequency Wn 'stop' for an order 2*n bandstop digital filter if Wn is a two-element vector, Wn = [w1 w2]. The stopband is w1 < ω < w2. With different numbers of output arguments, butter directly obtains other realizations of the filter. To obtain zero-pole-gain form, use three output arguments as shown below: [z,p,k] = butter(n,wn) or [z,p,k] = butter(n,wn,'ftype') returns the zeros and poles in length n column vectors z and p, and the gain in the scalar k. To obtain state-space form, use four output arguments as shown below: [A,B,C,D] = butter(n,wn) or [A,B,C,D] = butter(n,wn,'ftype') where A, B, C, and D are x[ n + 1] = Ax[ n] + Bu[ n] y[ n] = Cx[ n] + Du[ n] and u is the input, x is the state vector, and y is the output. Analog Domain [b,a] = butter(n,wn,'s') designs an order n lowpass analog Butterworth filter with angular cutoff frequency Wn rad/s. It returns the filter coefficients in the length n+1 row vectors b and a, in descending powers of s, derived from this transfer function: B( s) b( 1)s H( s) ---------- n + b( 2)s n 1 +! + b ( n + 1 ) = = ------------------------------------------------------------------------------------ A( s) s n + a( 2)s n 1 +! + a ( n + 1 ) butter s angular cutoff frequency Wn must be greater than 0 rad/s. If Wn is a two-element vector with w1 < w2, butter(n,wn,'s') returns an order 2*n bandpass analog filter with passband w1 < ω < w2. [b,a] = butter(n,wn,'ftype','s') designs a highpass, lowpass, or bandstop filter. 7-57 7-58

conv ellip 2conv Convolution and polynomial multiplication 7ellip Elliptic (Cauer) filter design Definition w = conv(u,v) w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same operation as multiplying the polynomials whose coefficients are the elements of u and v. Let m = length(u) and n = length(v). Then w is the vector of length m+n-1 whose kth element is The sum is over all the values of j which lead to legal subscripts for u(j) and v(k+1-j), specifically j = max(1,k+1-n): min(k,m). When m = n, this gives w(1) = u(1)*v(1) w(2) = u(1)*v(2)+u(2)*v(1) w(3) = u(1)*v(3)+u(2)*v(2)+u(3)*v(1)... w(n) = u(1)*v(n)+u(2)*v(n-1)+... +u(n)*v(1)... w(2*n-1) = u(n)*v(n) The convolution theorem says, roughly, that convolving two sequences is the same as multiplying their Fourier transforms. In order to make this precise, it is necessary to pad the two vectors with zeros and ignore roundoff error. Thus, if and! w( k) # u( j)v( k " 1! j) j X = fft([x zeros(1,length(y)-1)]) Y = fft([y zeros(1,length(x)-1)]) then conv(x,y) = ifft(x.*y) [b,a] = ellip(n,rp,rs,wp) [b,a] = ellip(n,rp,rs,wp,'ftype') [b,a] = ellip(n,rp,rs,wp,'s') [b,a] = ellip(n,rp,rs,wp,'ftype','s') [z,p,k] = ellip(...) [A,B,C,D] = ellip(...) ellip designs lowpass, bandpass, highpass, and bandstop digital and analog elliptic filters. Elliptic filters offer steeper rolloff characteristics than Butterworth or Chebyshev filters, but are equiripple in both the pass- and stopbands. In general, elliptic filters meet given performance specifications with the lowest order of any filter type. Digital Domain [b,a] = ellip(n,rp,rs,wp) designs an order n lowpass digital elliptic filter with normalized passband edge frequency Wp, Rp db of ripple in the passband, and a stopband Rs db down from the peak value in the passband. It returns the filter coefficients in the length n+1 row vectors b and a, with coefficients in descending powers of z. B( z) H( z) = ---------- = ------------------------------------------------------------------------------------ b( 1) + b( 2)z 1 +! + b( n + 1)z n A( z) 1 + a( 2)z 1 +! + a( n + 1)z n The normalized passband edge frequency is the edge of the passband, at which the magnitude response of the filter is -Rp db. For ellip, the normalized cutoff frequency Wp is a number between 0 and 1, where 1 corresponds to half the sampling frequency (Nyquist frequency). Smaller values of passband ripple Rp and larger values of stopband attenuation Rs both lead to wider transition widths (shallower rolloff characteristics). If Wp is a two-element vector, Wp = [w1 w2], ellip returns an order 2*n bandpass filter with passband w1 < ω < w2. See Also conv2, convn, deconv, filter convmtx and xcorr in the Signal Processing Toolbox 2-460 7-246

ellip filter [b,a] = ellip(n,rp,rs,wp,'ftype') designs a highpass, lowpass, or bandstop filter, where the string 'ftype' is one of the following. 'high' for a highpass digital filter with normalized passband edge frequency Wp 'low' for a lowpass digital filter with normalized passband edge frequency Wp 'stop' for an order 2*n bandstop digital filter if Wp is a two-element vector, Wp = [w1 w2]. The stopband is w1 < ω < w2. With different numbers of output arguments, ellip directly obtains other realizations of the filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = ellip(n,rp,rs,wp) or [z,p,k] = ellip(n,rp,rs,wp,'ftype') returns the zeros and poles in length n column vectors z and p and the gain in the scalar k. To obtain state-space form, use four output arguments as shown below: [A,B,C,D] = ellip(n,rp,rs,wp) or [A,B,C,D] = ellip(n,rp,rs,wp,'ftype') where A, B, C, and D are x[ n + 1] = Ax[ n] + Bu[ n] y[ n] = Cx[ n] + Du[ n] and u is the input, x is the state vector, and y is the output. Analog Domain [b,a] = ellip(n,rp,rs,wp,'s') designs an order n lowpass analog elliptic filter with angular passband edge frequency Wp rad/s and returns the filter coefficients in the length n+1 row vectors b and a, in descending powers of s, derived from this transfer function: H( s) B ---------- ( s) b( 1)s = = ------------------------------------------------------------------------------------ n + b( 2)s n 1 +! + b( n + 1) A( s) s n + a( 2)s n 1 +! + a( n + 1) Example 2filter Filter data with an infinite impulse response (IIR) or finite impulse response (FIR) filter y = filter(b,a,x) [y,zf] = filter(b,a,x) [y,zf] = filter(b,a,x,zi) y = filter(b,a,x,zi,dim) [...] = filter(b,a,x,[],dim) The filter function filters a data sequence using a digital filter which works for both real and complex inputs. The filter is a direct form II transposed implementation of the standard difference equation (see ). y = filter(b,a,x) filters the data in vector X with the filter described by numerator coefficient vector b and denominator coefficient vector a. If a(1) is not equal to 1, filter normalizes the filter coefficients by a(1). If a(1) equals 0, filter returns an error. If X is a matrix, filter operates on the columns of X. If X is a multidimensional array, filter operates on the first nonsingleton dimension. [y,zf] = filter(b,a,x) returns the final conditions, zf, of the filter delays. If X is a row or column vector, output zf is a column vector of max(length(a),length(b))-1. If X is a matrix, zf is an array of such vectors, one for each column of X, and similarly for multidimensional arrays. [y,zf] = filter(b,a,x,zi) accepts initial conditions, zi, and returns the final conditions, zf, of the filter delays. Input zi is a vector of length max(length(a),length(b))-1, or an array with the leading dimension of size max(length(a),length(b))-1 and with remaining dimensions matching those of X. y = filter(b,a,x,zi,dim) and [...] = filter(b,a,x,[],dim) operate across the dimension dim. You can use filter to find a running average without using a for loop. This example finds the running average of a 16-element vector, using a window size of 5. data = [1:0.2:4]'; 7-247 2-825

filter filter windowsize = 5; filter(ones(1,windowsize)/windowsize,1,data) The operation of filter at sample m is given by the time domain difference equations ans = 0.2000 0.4400 0.7200 1.0400 1.4000 1.6000 1.8000 2.0000 2.2000 2.4000 2.6000 2.8000 3.0000 3.2000 3.4000 3.6000 See Also y( m) # b( 1)x( m) " z 1 ( m! 1) z 1 ( m) # b( 2)x( m) " z 2 ( m! 1)! a( 2)y( m). =.. z n! 2 ( m) # b( n! 1)x( m) " z n! 1 ( m! 1)! a( n! 1)y( m) z n! 1 ( m) # b( n)x( m)! a( n)y( m) The input-output description of this filtering operation in the z -transform domain is a rational transfer function, b( 1) " b( 2)z Y( z)! 1 " " b( nb " 1)z # $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$X! nb 1 " a( 2)z! 1 " " a( na " 1)z! na ( z ) filter2 filtfilt, filtic in the Signal Processing Toolbox The filter function is implemented as a direct form II transposed structure, References [1] Oppenheim, A. V. and R.W. Schafer. Discrete-Time Signal Processing, Englewood Cliffs, NJ: Prentice-Hall, 1989, pp. 311-312. x(m)... b(n) b(3) b(2) b(1)! Z 1 Z n 1 (m) a(n)...! Z 1! Z 1 Z 2 (m) Z 1 (m) a(3) a(2)! y(m)... or y(n) = b(1)*x(n) + b(2)*x(n-1) +... + b(nb+1)*x(n-nb) - a(2)*y(n-1) -... - a(na+1)*y(n-na) where n-1 is the filter order, and which handles both FIR and IIR filters [1]. 2-826 2-827

freqz poly 7freqz Frequency response of digital filter 2poly Polynomial with specified roots [h,w]= freqz(b,a,l) h = freqz(b,a,w) [h,w] = freqz(b,a,l,'whole') [h,f] = freqz(b,a,l,fs) h = freqz(b,a,f,fs) [h,f] = freqz(b,a,l,'whole',fs) freqz(b,a,...) freqz(hd) [h,w] = freqz(b,a,l) returns the frequency response vector h and the corresponding angular frequency vector w for the digital filter whose transfer function is determined by the (real or complex) numerator and denominator polynomials represented in the vectors b and a, respectively. The vectors h and w are both of length l. The angular frequency vector w has values ranging from 0 to π radians per sample. When you don t specify the integer l, or you specify it as the empty vector [], the frequency response is calculated using the default value of 512 samples. Remarks p = poly(a) p = poly(r) p = poly(a) where A is an n-by-n matrix returns an n+1 element row vector whose elements are the coefficients of the characteristic polynomial, det( sl! A)! The coefficients are ordered in descending powers: if a vector c has n+1 components, the polynomial it represents is c 1 s n " " c n s " c n " 1 p = poly(r) where r is a vector returns a row vector whose elements are the coefficients of the polynomial whose roots are the elements of r. Note the relationship of this command to r = roots(p) which returns a column vector whose elements are the roots of the polynomial specified by the coefficients row vector p. For vectors, roots and poly are inverse functions of each other, up to ordering, scaling, and roundoff error. h = freqz(b,a,w) returns the frequency response vector h calculated at the frequencies (in radians per sample) supplied by the vector w. The vector w can have any length. Examples MATLAB displays polynomials as row vectors containing the coefficients ordered by descending powers. The characteristic equation of the matrix A = [h,w] = freqz(b,a,l,'whole') uses n sample points around the entire unit circle to calculate the frequency response. The frequency vector w has length l and has values ranging from 0 to 2π radians per sample. 1 2 3 4 5 6 7 8 0 [h,f] = freqz(b,a,l,fs) returns the frequency response vector h and the corresponding frequency vector f for the digital filter whose transfer function is determined by the (real or complex) numerator and denominator polynomials represented in the vectors b and a, respectively. The vectors h and f are both of length l. For this syntax, the frequency response is calculated using the sampling frequency specified by the scalar fs (in hertz). The frequency vector f is calculated in units of hertz (Hz). The frequency vector f has values ranging from 0 to fs/2 Hz. is returned in a row vector by poly: p = poly(a) p = 1-6 -72-27 The roots of this polynomial (eigenvalues of matrix A) are returned in a column vector by roots: r = roots(p) 7-314 2-1705

poly polyval r = 2polyval Polynomial evaluation See Also 12.1229-5.7345-0.3884 The algorithms employed for poly and roots illustrate an interesting aspect of the modern approach to eigenvalue computation. poly(a) generates the characteristic polynomial of A, and roots(poly(a)) finds the roots of that polynomial, which are the eigenvalues of A. But both poly and roots use eig, which is based on similarity transformations. The classical approach, which characterizes eigenvalues as roots of the characteristic polynomial, is actually reversed. If A is an n-by-n matrix, poly(a) produces the coefficients c(1) through c(n+1), with c(1) = 1, in det (!I! A) # c 1! n " " c n! " c n " 1 The algorithm is z = eig(a); c = zeros(n+1,1); c(1) = 1; for j = 1:n c(2:j+1) = c(2:j+1)-z(j)*c(1:j); end This recursion is easily derived by expanding the product. (!!! 1 )(!!! 2 ) (!!! n ) It is possible to prove that poly(a) produces the coefficients in the characteristic polynomial of a matrix within roundoff error of A. This is true even if the eigenvalues of A are badly conditioned. The traditional algorithms for obtaining the characteristic polynomial, which do not use the eigenvalues, do not have such satisfactory numerical properties. conv, polyval, residue, roots Remarks y = polyval(p,x) y = polyval(p,x,[],mu) [y,delta] = polyval(p,x,s) [y,delta] = polyval(p,x,s,mu) y = polyval(p,x) returns the value of a polynomial of degree n evaluated at x. The input argument p is a vector of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated. y # p 1 x n " p 2 x n! 1 " " p x " p n n " 1 x can be a matrix or a vector. In either case, polyval evaluates p at each element of x. y = polyval(p,x,[],mu) uses x $ # ( x! µ 1 ) µ 2 in place of x. In this equation, µ 1 # %&'() x* and µ 2 # +,-) x*. The centering and scaling parameters mu = [ µ 1, µ 2 ] are optional output computed by polyfit. [y,delta] = polyval(p,x,s) and [y,delta] = polyval(p,x,s,mu) use the optional output structure S generated by polyfit to generate error estimates, y±delta. If the errors in the data input to polyfit are independent normal with constant variance, y±delta contains at least 50% of the predictions. The polyvalm(p,x) function, with x a matrix, evaluates the polynomial in a matrix sense. See polyvalm for more information. Examples The polynomial p( x) # 3x 2 " 2x " 1 is evaluated at x!= 5, 7, and 9 with p = [3 2 1]; polyval(p,[5 7 9]) which results in ans = 86 162 262 For another example, see polyfit. 2-1706 2-1715

residue residue 2residue Convert between partial fraction expansion and polynomial coefficients [r,p,k] = residue(b,a) [b,a] = residue(r,p,k) The residue function converts a quotient of polynomials to pole-residue representation, and back again. Arguments b,a r p k Vectors that specify the coefficients of the polynomials in descending powers of s Column vector of residues Column vector of poles Row vector of direct terms Definition [r,p,k] = residue(b,a) finds the residues, poles, and direct term of a partial fraction expansion of the ratio of two polynomials, b( s) and a( s), of the form b( s) b!!!!!!!!!! 1 s m # b 2 s m " 1 # b 3 s m " 2 # # b m # 1 $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! a( s) a 1 s n # a 2 s n " 1 # a 3 s n " 2 # # a n # 1 where b j and a j are the jth elements of the input vectors b and a. [b,a] = residue(r,p,k) converts the partial fraction expansion back to the polynomials with coefficients in b and a. If there are no multiple roots, then Limitations It first obtains the poles with roots. Next, if the fraction is nonproper, the direct term k is found using deconv, which performs polynomial long division. Finally, the residues are determined by evaluating the polynomial with individual roots removed. For repeated roots, resi2 computes the residues at the repeated root locations. Numerically, the partial fraction expansion of a ratio of polynomials represents an ill-posed problem. If the denominator polynomial, a( s), is near a polynomial with multiple roots, then small changes in the data, including roundoff errors, can make arbitrarily large changes in the resulting poles and residues. Problem formulations making use of state-space or zero-pole representations are preferable. b( s) r!!!!!!!!!! 1 r!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2 r n $ # # #!!!!!!!!!!!!!! # k( s) a( s) s " p 1 s " p 2 s " p n The number of poles n is n = length(a)-1 = length(r) = length(p) The direct term coefficient vector is empty if length(b) < length(a); otherwise Examples If the ratio of two polynomials is expressed as then b( s) 5s 3 # 3s 2 " 2s # 7!!!!!!!!!! $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! a( s) " 4s 3 # 8s # 3 b = [ 5 3-2 7] a = [-4 0 8 3] length(k) = length(b)-length(a)+1 If p(j) =... = p(j+m-1) is a pole of multiplicity m, then the expansion includes terms of the form r j r!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! j # 1 s " p j ( s " p j ) 2 r j # m " 1 # # #!!!!!!!!!!!!!!!!!!!!!! ( s " p j ) m and you can calculate the partial fraction expansion as [r, p, k] = residue(b,a) r = -1.4167-0.6653 1.3320 2-1860 2-1861

residue roots p = 1.5737-1.1644-0.4093 k = -1.2500 Now, convert the partial fraction expansion back to polynomial coefficients. [b,a] = residue(r,p,k) 2roots Polynomial roots r = roots(c) r = roots(c) returns a column vector whose elements are the roots of the polynomial c. Row vector c contains the coefficients of a polynomial, ordered in descending powers. If c has n+1 components, the polynomial it represents is c 1 s n!! c n s! c n! 1. See Also References b = -1.2500-0.7500 0.5000-1.7500 a = 1.0000-0.0000-2.0000-0.7500 The result can be expressed as b( s) " 1.25s 3 " 0.75s 2 # 0.50s " 1.75!!!!!!!!!! $!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! a( s) s 3 " 2.00s " 0.75 Note that the result is normalized for the leading coefficient in the denominator. deconv, poly, roots [1] Oppenheim, A.V. and R.W. Schafer, Digital Signal Processing, Prentice-Hall, 1975, p. 56. Remarks Note the relationship of this function to p = poly(r), which returns a row vector whose elements are the coefficients of the polynomial. For vectors, roots and poly are inverse functions of each other, up to ordering, scaling, and roundoff error. Examples The polynomial s 3 " 6s 2 " 72s " 27 is represented in MATLAB as p = [1-6 -72-27] The roots of this polynomial are returned in a column vector by r = roots(p) r = 12.1229-5.7345-0.3884 The algorithm simply involves computing the eigenvalues of the companion matrix: A = diag(ones(n-1,1),-1); A(1,:) = -c(2:n+1)./c(1); eig(a) It is possible to prove that the results produced are the exact eigenvalues of a matrix within roundoff error of the companion matrix A, but this does not mean that they are the exact roots of a polynomial with coefficients within roundoff error of those in c. 2-1862 2-1885

zplane zplane 7zplane Zero-pole plot zplane(z,p) zplane(b,a) zplane(hd) [hz,hp,ht] = zplane(z,p) Examples For data sampled at 1000 Hz, plot the poles and zeros of a 4th-order elliptic lowpass digital filter with cutoff frequency of 200 Hz, 3 db of ripple in the passband, and 30 db of attenuation in the stopband: [z,p,k] = ellip(4,3,30,200/500); zplane(z,p); title('4th-order Elliptic Lowpass Digital Filter'); This function displays the poles and zeros of discrete-time systems. 4th Order Elliptic Lowpass Digital Filter zplane(z,p) plots the zeros specified in column vector z and the poles specified in column vector p in the current figure window. The symbol 'o' represents a zero and the symbol 'x' represents a pole. The plot includes the unit circle for reference. If z and p are arrays, zplane plots the poles and zeros in the columns of z and p in different colors. You can override the automatic scaling of zplane using or axis([xmin xmax ymin ymax]) Imaginary Part 1 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 set(gca,'ylim',[ymin ymax]) 0.8 or set(gca,'xlim',[xmin xmax]) 1 1 0.5 0 0.5 1 Real Part after calling zplane. This is useful in the case where one or a few of the zeros or poles have such a large magnitude that the others are grouped tightly around the origin and are hard to distinguish. zplane(b,a) where b and a are row vectors, first uses roots to find the zeros and poles of the transfer function represented by numerator coefficients b and denominator coefficients a. To generate the same plot with a transfer function representation of the filter, use: [b,a] = ellip(4,3,30,200/500); zplane(b,a) % Transfer function To generate the same plot using a dfilt object and displaying the result in the Filter Visualization Tool (fvtool) use: zplane(hd) finds the zeros and poles of the transfer function represented by the dfilt filter object Hd. The pole-zero plot is displayed in fvtool. [hz,hp,ht] = zplane(z,p) returns vectors of handles to the zero lines, hz, and the pole lines, hp. ht is a vector of handles to the axes/unit circle line and to text objects, which are present when there are multiple zeros or poles. If there are no zeros or no poles, hz or hp is the empty matrix []. [b,a] = ellip(4,3,30,200/500); Hd=dfilt.df1(b,a); zplane(hd) 7-681 7-682