sos2ctf - Convert digital filter second-order section parameters to cascaded transfer
function form - MATLAB ([original](https://in.mathworks.com/help/signal/ref/sos2ctf.html)) ([raw](?raw))
Convert digital filter second-order section parameters to cascaded transfer function form
Since R2024a
Syntax
Description
[[B,A](#mw%5F7e6fe7d3-4a3d-48b2-9cc2-c788581cafa0)] = sos2ctf([sos](#mw%5F3c1dae93-3ad6-47d5-acc0-fef573f81e68),[g](#mw%5Fc5b62f65-fba7-4f3e-ad5d-7ef56b490567))
also specifies the scale values g
to perform gain scaling across the sections of the cascaded transfer function of the system.
Examples
Convert a second-order sections matrix to the cascaded transfer function form.
sos = [2 4 2 1 0 0;3 2 0 1 1 0];
[ctfB,ctfA] = sos2ctf(sos)
Obtain the cascaded transfer function of a 10th-order lowpass elliptic filter with a normalized cutoff frequency of 0.25πrad/sample.
[z,p,k] = ellip(10,1,60,0.25); [sos,g] = zp2sos(z,p,k);
[b,a] = sos2ctf(sos,g)
b = 5×3
0.3216 0.2716 0.3216
0.3216 -0.2850 0.3216
0.3216 -0.4033 0.3216
0.3216 -0.4345 0.3216
0.3216 -0.4432 0.3216
a = 5×3
1.0000 -1.5959 0.6751
1.0000 -1.5123 0.8125
1.0000 -1.4458 0.9225
1.0000 -1.4169 0.9730
1.0000 -1.4099 0.9936
Plot the filter response.
Input Arguments
Second-order section representation, specified as an _L_-by-6 matrix, where L is the number of second-order sections. The matrix
represents the second-order sections of_H_(z):
Example: [z,p,k] = butter(3,1/32); sos = zp2sos(z,p,k)
specifies a third-order Butterworth filter with a normalized 3 dB frequency of_π_/32 rad/sample.
Data Types: single
| double
Complex Number Support: Yes
Scale values, specified as a real-valued scalar or as a real-valued vector with L+1 elements, where L is the number of second-order sections.
The sos2ctf
function applies a gain to the filter sections using the scaleFilterSections function. Depending on the value you specify ing
:
- Scalar — The function uniformly distributes the gain 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.
Output Arguments
Cascaded transfer function coefficients, returned as _L_-by-3 matrices, where L is the number of second-order sections.
The matrices B
and A
list the numerator and denominator coefficients of the cascaded transfer function, respectively. See Return Digital Filters in CTF Format for more information.
More About
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_H_1(z),_H_2(z), …,H L(z) is
Get the filter coefficients by specifying to return B
andA
. That way, you can have digital filters in CTF format for analysis, visualization and signal filtering.
Filter Coefficients
When you specify to return the numerator and denominator coefficients in the CTF format, the_L_-row matrices B and A are returned as
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.
Note
- To filter signals using cascaded transfer functions, use the ctffilt function.
- To analyze filters represented as cascaded transfer functions, use theFilter Analyzer app. You can also use these Signal Processing Toolbox™ functions to visualize and analyze filters in CTF format:
- Time-Domain Responses — impzlength,impz, andstepz
- Frequency-Domain Responses — freqz,grpdelay,phasedelay, phasez,zerophase, and zplane
- Filter Exploration — filtord,islinphase,ismaxphase,isminphase, and isstable
Algorithms
The sos2ctf
function computes the numerator and denominator coefficients of the cascaded-transfer-function sections from the second-order-section coefficients of the filter system.
The output arguments B
and A
contain the second-order cascaded transfer function coefficients of the filter system distributed inL
rows.
- Each row of
A
andB
lists the coefficients in each section. - The
sos2ctf
function returns the _L_-by-3 matricesB
andA
, where the last two columns correspond to the _z_–1 and _z_–2 terms for each cascaded section of the filter system.
For a second-order-section matrix sos
, and unity scale value (g=1
), the values for B
and A
are these:
B = sos(:,1:3); A = sos(:,4:6);
If you specify g
, sos2ctf
distributes the scale values from g
across the numerator coefficients, so that the values for B
and A
are these:
B = scaleFilterSections(sos(:,1:3),g); A = sos(:,4:6);
References
[1] Lyons, Richard G. Understanding Digital Signal Processing. Upper Saddle River, NJ: Prentice Hall, 2004.
Extended Capabilities
Version History
Introduced in R2024a