scaleFilterSections

Scale cascaded transfer functions with scale values

Since R2023b

Syntax

ctfg = scaleFilterSections(ctf,g)

Description

example

ctfg = scaleFilterSections(ctf,g) scales the sections of the cascaded transfer function matrix ctf with the scale values specified in g.

Examples

collapse all

Design a 14th-order elliptic bandpass filter with a lower passband frequency of $\pi /5$ rad/sample and a higher passband frequency of $3\pi /5$ rad/sample. Specify 10 dB of passband ripple and 40 dB of stopband attenuation. Convert the zeros, poles, and gain to a cascaded transfer function format.

N = 14; [z,p,k] = ellip(N/2,10,40,[0.2 0.6]); [sos,g] = zp2sos(z,p,k);

Use scaleFilterSections to scale the filter numerator coefficients so that the gain is uniformly distributed across all sections. Visualize the magnitude response of the filter.

ctfNum = sos(:,1:3); ctfDen = sos(:,4:end); ctfNumG = scaleFilterSections(ctfNum,g); sosG = [ctfNum ctfDen]; [h,f] = freqz(sosG,4096); plot(f/pi,mag2db(abs(h))) xlabel("Frequency (\times\pi rad/sample)") ylabel("Magnitude (dB)") ylim([-40 40]) grid

Input Arguments

collapse all

Cascade of numerator filter coefficients, specified as a matrix. The number of rows of ctf equals L, the number of filter sections in the cascade. The number of columns of ctf equals N + 1, where N is the section order.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
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 | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Scaled numerator filter coefficients, returned as a matrix. ctfg has the same size as ctf.

Version History

Introduced in R2023b