# iirlp2bsc

Transform IIR lowpass to complex bandstop filter

## Syntax

``````[Num,Den,AllpassNum,AllpassDen] = iirlp2bsc(B,A,Wo,Wt)``````

## Description

example

``` ```[Num,Den,AllpassNum,AllpassDen] = iirlp2bsc(B,A,Wo,Wt)``` transform IIR lowpass to complex bandstop filter.The `iirlp2bsc` function returns the numerator and denominator vectors, `Num` and `Den`, respectively of the target filter transformed from the real lowpass prototype by applying a first-order real lowpass to complex bandstop frequency transformation. For more details, see IIR Lowpass Filter to IIR Complex Bandstop Filter Transformation. The function also returns the numerator, `AllpassNum`, and the denominator, `AllpassDen`, of the allpass mapping filter. The prototype lowpass filter is specified with the numerator `B` and denominator `A`.```

## Examples

collapse all

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);`

Create a complex bandstop filter by placing the cutoff frequencies of the prototype filter at –0.25π and 0.75π.

`[num,den] = iirlp2bsc(b,a,0.5,[-0.25 0.75]);`

Compare the magnitude responses of the filters using FVTool.

```fvt = fvtool(b,a,num,den); legend(fvt,'Prototype','Target')```

## Input Arguments

collapse all

Numerator of the prototype lowpass filter, specified as a row vector.

Data Types: `single` | `double`
Complex Number Support: Yes

Denominator of the prototype lowpass filter, specified as a row vector.

Data Types: `single` | `double`
Complex Number Support: Yes

Frequency value to be transformed from the prototype filter, specified as a scalar. Frequency `Wo` should be normalized to be between `0` and `1`, with `1` corresponding to half the sample rate.

Data Types: `single` | `double`

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

collapse all

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

Data Types: `single` | `double`
Complex Number Support: Yes

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

Data Types: `single` | `double`
Complex Number Support: Yes

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

Data Types: `single` | `double`
Complex Number Support: Yes

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

Data Types: `single` | `double`
Complex Number Support: Yes

collapse all

### IIR Lowpass Filter to IIR Complex Bandstop Filter Transformation

IIR Lowpass Filter to IIR Complex Bandstop Filter transformation effectively places one feature of the original filter, located at frequency -Wo, at the required target frequency location, Wt1, and the second feature, originally at `+`Wo, at the new location, Wt2. It is assumed that Wt2 is greater than Wt1. Additionally the transformation swaps passbands with stopbands in the target filter.

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, F1 and F2, with F1 preceding F2. Feature F1 will still precede F2 after the transformation. However, the distance between F1 and F2 will not be the same before and after the transformation.

Choice of the feature subject to the lowpass to bandstop 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/resonators. This transformation can be used for designing bandstop filters for band attenuation or frequency equalizers, from the high-quality prototype lowpass filter.