scaleFilterSections - Scale cascaded transfer functions with scale values - MATLAB (original) (raw)
Scale cascaded transfer functions with scale values
Since R2023b
Syntax
Description
[Bg](#mw%5F6fb30b33-7740-412a-8ac6-d4c78493c702) = scaleFilterSections([B](#mw%5Fcb482135-57d0-45ae-9305-18af420209fc),[g](#mw%5F4f4d110d-3653-47d0-bcd3-bbd5c48f99ea))
scales the sections of the numerator filter coefficients B
represented with Cascaded Transfer Functions (CTF) by applying the scale values specified in g
.
Examples
Design a 14th-order elliptic bandpass digital filter with a lower passband frequency of π/5 rad/sample and a higher passband frequency of 3π/5 rad/sample. Specify 10 dB of passband ripple and 40 dB of stopband attenuation. Represent the filter using cascaded transfer functions.
N = 14; [B,A] = ellip(N/2,10,40,[0.2 0.6],"ctf")
B = 4×5
0.4184 0.0000 -0.4184 0 0
0.4184 -0.3351 0.1684 -0.3351 0.4184
0.4184 -0.4070 0.3842 -0.4070 0.4184
0.4184 -0.4158 0.4107 -0.4158 0.4184
A = 4×5
1.0000 -0.7094 0.8572 0 0
1.0000 -1.1435 1.4172 -1.0733 0.9081
1.0000 -1.0196 1.0568 -1.0091 0.9862
1.0000 -1.0010 1.0029 -0.9998 0.9984
Define scale values as a vector with incremental gains (1, 2, ..., L) for each of the L sections, and append the overall system gain as 0.5L. This vector makes the numerator coefficients be scaled by 0.5, 1, ..., 0.5L.
numSections = size(B,1); g = [1:numSections 0.5^(numSections)];
Use scaleFilterSections
to scale the filter numerator coefficients so that the gain is uniformly distributed across all sections.
Bg = scaleFilterSections(B,g)
Bg = 4×5
0.2092 0.0000 -0.2092 0 0
0.4184 -0.3351 0.1684 -0.3351 0.4184
0.6276 -0.6105 0.5764 -0.6105 0.6276
0.8367 -0.8317 0.8215 -0.8317 0.8367
Visualize the frequency response.
Input Arguments
Unscaled CTF numerator filter coefficients, specified as a matrix.
- The number of rows in
B
equals L, where L is the number of filter sections in the cascade. - The number of columns in
B
equals m + 1, where m is the section order. - If you specify
B
as a vector,scaleFilterSections
treatsB
as a matrix, determining the number of sections and the numerator order depending on vector size:- Row vector — The function treats
B
as a one-section transfer function with numerator order m, where m + 1 is the number of columns. The _i_th column ofB
corresponds to the _z_-(i - 1) numerator coefficient. - Column vector — The function treats
B
as an_L_-section transfer function with scalar numerators. Each row ofB
corresponds to a numerator in each corresponding section.
- Row vector — The function treats
Data Types: single
| double
Complex Number Support: Yes
Scale values, specified as a scalar or a vector with L + 1 elements, where L is the number of filter sections in the cascade.
- If
g
is a scalar,scaleFilterSections
applies the value uniformly to all the cascade filter sections. - If
g
is a vector,scaleFilterSections
applies each of the first L scale values to the corresponding filter section and the last scale value uniformly to all the filter sections.
Data Types: single
| double
Output Arguments
Scaled CTF numerator filter coefficients, returned as a matrix of the same size asB.
See Algorithms 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
Algorithms
The scaleFilterSections
function scales the matrix B with a scalar or vector g and returns Bg as one of these:
- If
g
is a scalar:
L = size(B,1);
gL = (abs(g))^(1/L);
Bg = B*gL;
Bg(L,:) = sign(g)*Bg(L,:); - If
g
is a vector with L+1 samples, given_L_ sections:
L = size(B,1);
gS = g(end);
gL = (abs(gS))^(1/L);
gl = g(1:end-1);
Bg = B.*gl(:)*gL;
Bg(L,:) = sign(gS)*Bg(L,:);
References
[1] Lyons, Richard G. Understanding Digital Signal Processing. Upper Saddle River, NJ: Prentice Hall, 2004.
Version History
Introduced in R2023b