Engee documentation

zp2ctf

Converting filter parameters with zeros, poles, and gain into a cascade form of the transfer function.

Library

EngeeDSP

Syntax

Function call

  • B,A = zp2ctf(z,p,k) — sets the scalar gain of the system.

  • B,A = zp2ctf(___,Name,Value) — sets additional parameters using name-value arguments.

  • ___,gS = zp2ctf(___) — also returns the total gain of the system.

Arguments

Input arguments

# z,p — zeros and poles of the system

+ vectors

Details

The zeros and poles of the filter, set as vectors.

Vectors z and p They contain zeros and poles of the transfer function accordingly.

Типы данных

Float64

Support for complex numbers

Yes

# k is the system gain factor

+ 1 | scalar

Details

The system’s gain factor, set as a real scalar.

Scalar represents the gain factor of the transfer function .

If you are requesting an output argument gS, then the function zp2ctf assigns a value k the argument gS.

Типы данных

Float64

Name-value input arguments

Specify optional argument pairs as Name,Value, where Name — the name of the argument, and Value — the appropriate value. Name-value arguments should be placed after other arguments, but the order of the pairs does not matter.

Use commas to separate the name and value, and Name put it in quotation marks.

# SectionOrder — the order of sections of transfer functions

+ 2 (by default) | 4

Details

The order of the transfer function sections, given as 2 or 4. Depending on the value specified for the argument SectionOrder, function zp2ctf returns either a cascade transfer function of the second order, or a cascade transfer function of the fourth order.

  • 2 — function zp2ctf returns matrices B and A the cascade form of the transfer function in the form of second-order sections with three columns each.

  • 4 — function zp2ctf returns matrices B and A the cascade form of the transfer function in the form of fourth-order sections with five columns each.

Типы данных

Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

# Direction — the order of the transfer function sections

+ "up" (by default) | "down"

Details

The order of the sections of the transfer function, given as "up" or "down". Function zp2ctf sorts the rows of the matrix A depending on the distance between the poles and the origin.

  • "up" — the first row of the matrix A contains the poles closest to the origin.

  • "down" — the first row of the matrix A contains the poles closest to the unit circle.

Function zp2ctf sorts the rows of the matrix B so that the zeros in each section are paired with the nearest poles corresponding to the rows of the matrix. A.

Типы данных

String

# Scale — gain scaling

+ "none" (default) | "inf" | "l2"

Details

Gain scaling, set as "none", "inf" or "l2". Function zp2ctf scales the gain and numerator coefficients of all sections using the function filternorm depending on the value specified for the parameter Scale:

  • "none" — without scaling;

  • "inf" — infinite rate scaling;

  • "l2" — scaling according to the L2 norm.

  • Scaling by infinite norm and L2 norm is suitable only for direct form II implementations and is supported only for stable systems.

  • Using infinite norm scaling in combination with the direction order "up" minimizes the chance of overflow when implementing filters. On the other hand, the use of L2 norm scaling in combination with the direction order "down" minimizes peak rounding noise.

Типы данных

String

Output arguments

# B,A are the coefficients of the cascade transfer function

+ the L × 3 matrix (by default) | the L × 5 matrix

Details

The coefficients of the cascade transfer function returned as matrices of size on or on , where — the number of sections. The number of columns depends on the value specified for the argument SectionOrder.

In matrices B and A The coefficients of the numerator and denominator of the cascade transfer function are listed, respectively. For more information, see Representation of digital filters in CTF format.

# gS is the total gain of the system

+ scalar

Details

The total gain of the system, returned as a real scalar.

  • If specified, you need to return gS, function zp2ctf normalizes the coefficients of the numerator relative to the system gain k and returns the total gain of the system as gS.

  • If not specified, what needs to be returned gS, function zp2ctf distributes the system gain evenly k for all sections of the system using the function scaleFilterSections.

Additional Info

Cascading transfer functions

Details

Splitting a digital IIR filter into cascaded sections increases its numerical stability and reduces its susceptibility to coefficient quantization errors. Cascade form of the transfer function expressed in terms of transfer functions , has the form

butter en

Representation of digital filters in CTF format

Details

Specify the arguments B and A to get the filter coefficients. You can also specify gS to get the overall gain of the filter. By specifying these output arguments, you can design digital filters in CTF format for signal analysis, visualization, and filtering.

coeffects of the filter

If you specify the representation of the numerator and denominator coefficients in CTF format, -lowercase matrices and they are returned as

thus, the total transfer function of the filter is

where — the order of the filter numerator, and — the order of the denominator.

The following functions can be used to visualize and analyze filters in CTF format:

  • Characteristics in the time domain — impzlength and impz.

  • Characteristics in the frequency domain — freqz, grpdelay, phasedelay and phasez.

  • Filter Research — islinphase, ismaxphase and isstable.

coeffects and amplification

You can specify that you want to return the coefficients and the total gain of the system using a triplet of output arguments. B,A,gS. In this case, the coefficients of the numerator are normalized, returning the matrices of the filter coefficients and the gain factor in the form

so the transfer function has the form

This transfer function is equivalent to the function defined in section Filter coefficients, where and by and .

Algorithms

Function zp2ctf calculates the coefficients of the numerator and denominator of the cascade sections of the transfer function based on zeros, poles, and the filter gain. For the filter -th order exists possible combinations [1]. Variable — the nearest integer greater than or equal to or for sections of the second or fourth order, respectively.

Set up the sorting criteria for combining zeros and poles into pairs in cascading sections by setting a value for the argument Direction to start with the poles and zeros closest to the origin -planes ("up"), or those closest to the unit circle ("down"). Scale the gain by cascade sections using the argument Scale. Adjust the order of cascading sections by setting for the argument SectionOrder meaning 2 or 4 to create cascading sections of the second or fourth order, respectively.

Output arguments B and A they contain the coefficients of the cascade transfer function of the second or fourth order of the filter, distributed according to lines.

  • Each line of arguments B and A contains a list of coefficients in each section.

    • The function returns the first column of the matrix A an equal 1, therefore, A(1) = 1 When A It is a string vector.

    • If you specify the need to return gS function zp2ctf normalizes the coefficients of the numerator so that the first column of the matrix B was equal to 1, and returns the total gain of the system as gS. Thus, B(1) = 1 When B It is a string vector.

    • If you do not specify gS as an output argument, the function zp2ctf first, normalizes the coefficients of the numerator so that the first column of the matrix B was equal to 1, and then evenly multiplies the normalized coefficients of the numerator by sgn(gS)*gS^(1/L), so the first column of the matrix is B will be equal to sgn(gS)*gS^(1/L). Thus, B(1) = gS When B It is a string vector.

  • When specifying second-order sections or ignoring the argument SectionOrder, function zp2ctf returns matrices B and A size on where the last two columns correspond to the members and for each cascade section of the filter.

  • When specifying fourth-order sections, the function zp2ctf returns matrices B and A size on where the last two columns correspond to the members and for each cascade section of the filter.

Literature

  1. Lyons, Richard G. Understanding Digital Signal Processing. Upper Saddle River, NJ: Prentice Hall, 2004.