# iirlp2bpc

Transform IIR lowpass filter to complex bandpass filter

## Description

`[`

transforms an IIR lowpass filter to a complex bandpass filter.`num`

,`den`

,`allpassNum`

,`allpassDen`

] =
iirlp2bpc(`b`

,`a`

,`wo`

,`wt`

)

The function transforms a real lowpass prototype filter, specified as the
numerator and denominator coefficients `b`

and
`a`

respectively, to a complex bandpass filter by applying a
first-order real lowpass to complex bandpass frequency transformation.

The function returns the numerator and denominator coefficients of the transformed
complex bandpass filter. The function also returns the numerator and denominator
coefficients of the allpass mapping filter, `allpassNum`

and
`allpassDen`

respectively.

For more details on the transformation, see IIR Lowpass to Complex Bandpass Transformation.

## Examples

### Transform Lowpass Filter to Complex Bandpass Filter

Transform a lowpass IIR filter to a complex bandpass filter using the `iirlp2bpc`

function.

**Input Lowpass IIR Filter**

Design a prototype real IIR lowpass elliptic filter with a gain of about –3 dB at 0.5π rad/sample.

[b,a] = ellip(3,0.1,30,0.409); filterAnalyzer(b,a)

**Transform Filter Using iirlp2bpc**

Transform the prototype lowpass filter into a complex bandpass filter by placing the cutoff frequencies of the prototype filter at 0.25π and 0.75π.

Specify the prototype filter as a vector of numerator and denominator coefficients, `b`

and `a`

respectively.

[num,den] = iirlp2bpc(b,a,0.5,[0.25 0.75]);

Compare the magnitude response of the filters.

filterAnalyzer(b,a,num,den,FrequencyRange="centered",... FilterNames=["PrototypeFilter_TFForm",... "TransformedFilter"]);

Alternatively, you can also specify the input lowpass IIR filter as a matrix of coefficients. Pass the second order section coefficient matrices as inputs.

ss = tf2sos(b,a); [num2,den2] = iirlp2bpc(ss(:,1:3),ss(:,4:6),0.5,[0.25 0.75]);

Use the `sos2ctf`

function to convert the second-order section matrices to the cascaded transfer function form.

[b_ctf,a_ctf] = sos2ctf(ss);

Compare the magnitude response of the filters.

filterAnalyzer(b_ctf,a_ctf,num2,den2,FrequencyRange="centered",... FilterNames=["PrototypeFilterFromSOSMatrix", ... "TransformedFilterFromSOSForm"]);

*Copyright 2012–2024 The MathWorks, Inc.*

## Input Arguments

`b`

— Numerator coefficients of prototype lowpass IIR filter

row vector | matrix

Numerator coefficients of the prototype lowpass IIR filter, specified as either:

Row vector –– Specifies the values of [

*b*_{0},*b*_{1}, …,*b*_{n}], given this transfer function form:$$H(z)=\frac{B(z)}{A(z)}=\frac{{b}_{0}+{b}_{1}{z}^{-1}+\cdots +{b}_{n}{z}^{-n}}{{a}_{0}+{a}_{1}{z}^{-1}+\cdots +{a}_{n}{z}^{-n}},$$

where

*n*is the order of the filter.Matrix –– Specifies the numerator coefficients in the form of an

*P*-by-(*Q*+1) matrix, where*P*is the number of filter sections and*Q*is the order of each filter section. If*Q*= 2, the filter is a second-order section filter. For higher-order sections, make*Q*> 2.$$b=\left[\begin{array}{ccccc}{b}_{01}& {b}_{11}& {b}_{21}& \mathrm{...}& {b}_{Q1}\\ {b}_{02}& {b}_{12}& {b}_{22}& \mathrm{...}& {b}_{Q2}\\ \vdots & \vdots & \vdots & \ddots & \vdots \\ {b}_{0P}& {b}_{1P}& {b}_{2P}& \cdots & {b}_{QP}\end{array}\right]$$

In the transfer function form, the numerator coefficient matrix

*b*of the IIR filter can be represented using the following equation:_{ik}$$H(z)={\displaystyle \prod _{k=1}^{P}{H}_{k}}(z)={\displaystyle \prod _{k=1}^{P}\frac{{b}_{0k}+{b}_{1k}{z}^{-1}+{b}_{2k}{z}^{-2}+\cdots +{b}_{Qk}{z}^{-Q}}{{a}_{0k}+{a}_{1k}{z}^{-1}+{a}_{2k}{z}^{-2}+\cdots +{a}_{Qk}{z}^{-Q}}},$$

where,

**a**–– Denominator coefficients matrix. For more information on how to specify this matrix, see`a`

.*k*–– Row index.*i*–– Column index.

When specified in the matrix form,

**b**and**a**matrices must have the same number of rows (filter sections)*Q*.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

`a`

— Denominator coefficients of prototype lowpass IIR filter

row vector | matrix

Denominator coefficients for a prototype lowpass IIR filter, specified as one of these options:

Row vector –– Specifies the values of [

*a*_{0},*a*_{1}, …,*a*_{n}], given this transfer function form:$$H(z)=\frac{B(z)}{A(z)}=\frac{{b}_{0}+{b}_{1}{z}^{-1}+\cdots +{b}_{n}{z}^{-n}}{{a}_{0}+{a}_{1}{z}^{-1}+\cdots +{a}_{n}{z}^{-n}},$$

where

*n*is the order of the filter.Matrix –– Specifies the denominator coefficients in the form of an

*P*-by-(*Q*+1) matrix, where*P*is the number of filter sections and*Q*is the order of each filter section. If*Q*= 2, the filter is a second-order section filter. For higher-order sections, make*Q*> 2.$$a=\left[\begin{array}{ccccc}{a}_{01}& {a}_{11}& {a}_{21}& \cdots & {a}_{Q1}\\ {a}_{02}& {a}_{12}& {a}_{22}& \cdots & {a}_{Q2}\\ \vdots & \vdots & \vdots & \ddots & \vdots \\ {a}_{0P}& {a}_{1P}& {a}_{2P}& \cdots & {a}_{QP}\end{array}\right]$$

In the transfer function form, the denominator coefficient matrix

*a*of the IIR filter can be represented using the following equation:_{ik}$$H(z)={\displaystyle \prod _{k=1}^{P}{H}_{k}}(z)={\displaystyle \prod _{k=1}^{P}\frac{{b}_{0k}+{b}_{1k}{z}^{-1}+{b}_{2k}{z}^{-2}+\cdots +{b}_{Qk}{z}^{-Q}}{{a}_{0k}+{a}_{1k}{z}^{-1}+{a}_{2k}{z}^{-2}+\cdots +{a}_{Qk}{z}^{-Q}}},$$

where,

**b**–– Numerator coefficients matrix. For more information on how to specify this matrix, see`b`

.*k*–– Row index.*i*–– Column index.

When specified in the matrix form,

**a**and**b**matrices must have the same number of rows (filter sections)*P*.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

`wo`

— Frequency value to transform from prototype filter

scalar

Frequency value to transform from the prototype filter, specified as a
real scalar. Frequency `wo`

should be normalized to be
between `0`

and `1`

, with
`1`

corresponding to half the sample rate.

**Data Types: **`single`

| `double`

`wt`

— Desired frequency locations in transformed target filter

two-element vector

Desired frequency locations in the transformed target filter, specified as
a two-element vector. Frequencies in `wt`

should be
normalized to be between `-1`

and `1`

,
with `1`

corresponding to half the sample rate.

**Data Types: **`single`

| `double`

## Output Arguments

`num`

— Numerator coefficients of transformed complex bandpass filter

row vector | matrix

Numerator coefficients of the transformed complex bandpass filter, returned as one of the following:

Row vector of length

*n*+1, where*n*is the order of the input filter. The`num`

output is a row vector when the input coefficients`b`

and`a`

are row vectors.*P*-by-(*Q*+1) matrix, where*P*is the number of filter sections and*Q*is the order of each section of the transformed filter. The`num`

output is a matrix when the input coefficients`b`

and`a`

are matrices.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

`den`

— Denominator coefficients of transformed complex bandpass filter

row vector | matrix

Denominator coefficients of the transformed complex bandpass filter, returned as one of the following:

Row vector of length

*n*+1, where*n*is the order of the input filter. The`den`

output is a row vector when the input coefficients`b`

and`a`

are row vectors.*P*-by-(*Q*+1) matrix, where*P*is the number of filter sections and*Q*is the order of each section of the transformed filter. The`den`

output is a matrix when the input coefficients`b`

and`a`

are matrices.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

`allpassNum`

— Numerator coefficients of mapping filter

row vector

Numerator of the mapping filter, returned as a row vector.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

`allpassDen`

— Denominator coefficients of mapping filter

row vector

Denominator of the mapping filter, returned as a row vector.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

## More About

### IIR Lowpass to Complex Bandpass Transformation

IIR lowpass to complex bandpass transformation effectively places
one feature of the original filter, located at frequency
−`w`

, at the required target
frequency location, _{o}`w`

, and the second
feature, originally at _{t1}`w`

, at the new
location, _{o}`w`

. It is assumed that
_{t2}`w`

is greater than
_{t2}`w`

._{t1}

Relative positions of other features of the original filter do not change in the
target filter. This means that it is possible to select two features of an original
filter, F_{1} and F_{2}, with
F_{1} preceding F_{2}. Feature
F_{1} will still precede F_{2} after the
transformation. However, the distance between F_{1} and
F_{2} will not be the same before and after the
transformation.

Choice of the feature subject to the lowpass to bandpass transformation is not restricted only to the cutoff frequency of an original lowpass filter. You can choose to transform any feature of the original filter like stopband edge, DC, deep minimum in the stopband, or others.

Lowpass to bandpass transformation can also be used to transform other types of filters, for example real notch filters or resonators can be doubled and positioned at two distinct desired frequencies at any place around the unit circle, forming a pair of complex notches or resonators. You can use this transformation to design bandpass filters for radio receivers from the high-quality prototype lowpass filter.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

## Version History

**Introduced in R2011a**

## 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)