mfilt.iirinterp
(Removed) IIR interpolator
Compatibility
Note
mfilt.iirinterp
has been removed. Use dsp.IIRHalfbandInterpolator
instead. For more details, see Version History.
Syntax
hm = mfilt.iirinterp(c1,c2,...)
Description
hm = mfilt.iirinterp(c1,c2,...)
constructs an IIR interpolator filter given the coefficients specified in the cell
arrays C1, C2, etc.
The IIR interpolator is a polyphase IIR filter where each phase is a cascade allpass IIR filter.
Each cell array ci
contains a set of vectors representing a
cascade of allpass sections. Each element in one cell array is one section. For
more information about the contents of each cell array, refer to
dfilt.cascadeallpass
. The contents of the cell arrays
are the same for both filter constructors and mfilt.iirdecim
interprets them same way as mfilt.cascadeallpass
.
The following exception applies to interpreting the contents of a cell
array—if one of the cell arrays ci
contains only one
vector, and that vector comprises a series of 0s and a unique element equal to 1,
that cell array represents a dfilt.delay
section with latency
equal to the number of zeros, rather than a
dfilt.cascadeallpass
section. This exception case occurs
with quasi-linear phase IIR interpolators.
Although the first example shows how to construct an IIR interpolator explicitly, one usually constructs an IIR interpolator filter as a result of designing an interpolator, as shown in the subsequent examples.
Examples
When the coefficients are known, you can construct the IIR interpolator directly
using mfilt.iirinterp
. In the following example, a cascaded
polyphase IIR interpolator filter is constructed using 2 phases for each of three
stages. The coefficients are given
below:
Phase1Sect1=0.0603;Phase1Sect2=0.4126; Phase1Sect3=0.7727; Phase2Sect1=0.2160; Phase2Sect2=0.6044; Phase2Sect3=0.9239;
Next the filter is implemented by passing the above coefficients to
mfilt.iirinterp
as cell arrays, where each cell array
represents a different phase.
Hm = mfilt.iirinterp({Phase1Sect1,Phase1Sect2,Phase1Sect3},... {Phase2Sect1,Phase2Sect2,Phase2Sect3}) Hm = FilterStructure: 'IIR Polyphase Interpolator' Polyphase: Phase1: Section1: 0.0603 Section2: 0.4126 Section3: 0.7727 Phase2: Section1: 0.216 Section2: 0.6044 Section3: 0.9239 InterpolationFactor: 2 PersistentMemory: false
Also refer to the “Quasi-Linear Phase Halfband and Dyadic Halfband Designs” section of IIR Halfband Stages in Multistage Filter Design.
When the coefficients are not known, use the approach given by the following set of examples. Start by designing an elliptic halfband interpolator with a interpolation factor of 2.
tw = 100; % Transition width of filter. ast = 80; % Stopband attenuation of filter. fs = 2000; % Sampling frequency of filter. l = 2; % Interpolation factor. d = fdesign.interpolator(l,'halfband','tw,ast',tw,ast,fs);
Specification object d
stores the interpolator design
specifics. With the details in d
, design the filter, returning
hm
, an mfilt.iirinterp
object. Use
hm
to realize the filter if you have Simulink® installed.
hm = design(d,'ellip','filterstructure','iirinterp'); % Note that realizemdl requires Simulink realizemdl(hm) % Build model of the filter.
Designing a linear phase halfband interpolator follows the same pattern.
tw = 100; % Transition width of filter. ast= 60; % Stopband attenuation of filter. fs = 2000; % Sampling frequency of filter. l = 2; % Interpolation factor. d = fdesign.interpolator(l,'halfband','tw,ast',tw,ast,fs);
fdesign.interpolator
returns a
specification object that stores the design features for an interpolator.
Now perform the actual design that results in an
mfilt.iirinterp
filter, hm
.
hm = design(d,'iirlinphase','filterstructure','iirinterp'); % Note that realizemdl requires Simulink realizemdl(hm) % Build model of the filter.
The toolbox creates a Simulink model for hm
, shown here. Phase1, Phase2, and
InterpCommutator are all subsystem blocks.