ctf2zp
Description
[
computes the zeros z,p
] = ctf2zp(B,A
)z
and poles p
of a system
represented as Cascaded Transfer Functions (CTF) with numerator coefficients B
and denominator coefficients
A
.
Examples
Zeros and Poles from Two-Section Digital Filter
Specify a two-section digital filter with a transfer function in the CTF format. Plot the 1024-point frequency response of the filter.
B = [0.1607 0.2414 0.4689
0.1607 0.0828 0.0551];
A = [ 1 0 0;
1 -1.1940 0.4360];
freqz(B,A,1024,"ctf")
Compute the zeros and poles of the transfer function.
[z,p] = ctf2zp(B,A)
z = 4×1 complex
-0.7511 + 1.5342i
-0.7511 - 1.5342i
-0.2576 + 0.5258i
-0.2576 - 0.5258i
p = 4×1 complex
0.0000 + 0.0000i
0.0000 + 0.0000i
0.5970 + 0.2821i
0.5970 - 0.2821i
Zero-Pole-Gain from Cascaded Transfer Function
Create a 10th-order bandpass digital elliptic filter in the CTF form.
[B,A,gS] = ellip(10,0.1,60,[0.35 0.65],"ctf")
B = 5×5
1.0000 -0.0000 -1.3205 0.0000 1.0000
1.0000 0.0000 0.3308 -0.0000 1.0000
1.0000 -0.0000 0.8670 -0.0000 1.0000
1.0000 0.0000 1.0340 0.0000 1.0000
1.0000 0.0000 1.0853 -0.0000 1.0000
A = 5×5
1.0000 -0.0000 1.2677 -0.0000 0.4407
1.0000 0.0000 1.2212 0.0000 0.6374
1.0000 -0.0000 1.1779 -0.0000 0.8251
1.0000 0.0000 1.1571 0.0000 0.9300
1.0000 -0.0000 1.1561 -0.0000 0.9818
gS = 0.0053
Specify scale values. Because the filter has five fourth-order sections, the vector of scale values must have six elements.
g = [1:size(B,1) gS]
g = 1×6
1.0000 2.0000 3.0000 4.0000 5.0000 0.0053
Get the zero-pole decomposition of the filter. Plot the zeros and poles in the z-plane.
[z,p,k] = ctf2zp(B,A,g);
zplane(z,p)
title("Pole-Zero Plot, k = "+k)
Input Arguments
B,A
— Cascaded transfer function (CTF) coefficients
scalars | vectors | matrices
Since R2024b
Cascaded transfer function (CTF) coefficients, specified as scalars, vectors, or
matrices. B
and A
list the numerator and
denominator coefficients of the cascaded transfer function, respectively.
B
must be of size L-by-(m +
1) and A
must be of size
L-by-(n + 1), where:
L represents the number of filter sections.
m represents the order of the filter numerators.
n represents the order of the filter denominators.
For more information about the cascaded transfer function format and coefficient matrices, see Specify Digital Filters in CTF Format.
Note
If any element of A(:,1)
is not equal to
1
, then ctf2zp
normalizes the
filter coefficients by A(:,1)
. In this case,
A(:,1)
must be nonzero.
Data Types: double
| single
Complex Number Support: Yes
g
— Scale values
1
(default) | scalar | vector
Since R2024b
Scale values, specified as a real-valued scalar or as a real-valued vector with L + 1 elements, where L is the number of CTF sections. The scale values represent the distribution of the filter gain across the sections of the cascaded filter representation.
The ctf2zp
function applies a gain to the filter sections
using the scaleFilterSections
function depending on how you specify
g
:
Scalar — The function distributes the gain uniformly across all filter sections.
Vector — The function applies the first L gain values to the corresponding filter sections and distributes the last gain value uniformly across all filter sections.
Data Types: double
| single
Output Arguments
z,p
— System zeros and poles
column vectors
System zeros and poles, returned as column vectors.
The vectors z
and p
contain the
n zeros and m poles of the transfer function
H(z), respectively.
k
— System gain
scalar
System gain, returned as a scalar.
The scalar k represents the gain of the transfer function H(z).
More About
Cascaded Transfer Functions
Partitioning an IIR digital filter into cascaded sections improves its numerical stability and reduces its susceptibility to coefficient quantization errors. The cascaded form of a transfer function H(z) in terms of the L transfer functions H1(z), H2(z), …, HL(z) is
Specify Digital Filters in CTF Format
You can specify digital filters in the CTF format for analysis, visualization, and signal
filtering. Specify a filter by listing its coefficients B
and
A
. You can also include the filter scaling gain across sections by
specifying a scalar or vector g
.
When you specify the coefficients as L-row matrices,
it is assumed that you have specified the filter as a sequence of L cascaded transfer functions, such that the full transfer function of the filter is
where m ≥ 0 is the numerator order of the filter and n ≥ 0 is the denominator order.
If you specify both B and A as vectors, it is assumed that the underlying system is a one-section IIR filter (L = 1), with B representing the numerator of the transfer function and A representing its denominator.
If B is scalar, it is assumed that the filter is a cascade of all-pole IIR filters with each section having an overall system gain equal to B.
If A is scalar, it is assumed that the filter is a cascade of FIR filters with each section having an overall system gain equal to 1/A.
Note
If you have an overall scaling gain or multiple scaling gains factored out from the
coefficient values, you can specify the coefficients and gain as a cell array of the form {B,A,g}
. Scaling filter sections is especially important when you work with
fixed-point arithmetic to ensure that the output of each filter section has similar
amplitude levels, which helps avoid inaccuracies in the filter response due to limited
numeric precision.
The gain can be a scalar overall gain or a vector of section gains.
If the gain is scalar, the value applies uniformly to all the cascade filter sections.
If the gain is a vector, it must have one more element than the number of filter sections L in the cascade. Each of the first L scale values applies to the corresponding filter section, and the last value applies uniformly to all the cascade filter sections.
If you specify the coefficient matrices and gain vector as
it is assumed that the transfer function of the filter system is
Tips
References
[1] Lyons, Richard G. Understanding Digital Signal Processing. Upper Saddle River, NJ: Prentice Hall, 2004.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)