# dsp.VariableFIRInterpolator

## Description

The `dsp.VariableFIRInterpolator`

object performs an efficient polyphase
FIR interpolation with a tunable interpolation factor. You can update the interpolation factor
and the filter coefficients while the simulation is running. To control the interpolation, you
can specify the interpolation factor or the output frame length.

When you specify the interpolation factor, if the input frame length changes (variable-size signal) during simulation, the output frame length also changes in order to keep the interpolation factor constant. When you specify the output frame length instead of the interpolation factor, and if the input frame length changes (variable-size signal) during simulation, the interpolation factor also changes in order to keep the output frame length constant.

Conceptually, the FIR interpolator (as shown in the schematic) consists of an upsampler
followed by an FIR anti-imaging filter, which is usually an approximation of an ideal
band-limited interpolation filter. To design an FIR anti-imaging filter, use the `designMultirateFIR`

function. The upsampler upsamples each channel of the input
to a higher rate by inserting *L*–1 zeros between samples. The FIR filter
that follows filters each channel of the upsampled data. The resulting discrete-time signal
has a sample rate that is *L* times the original sample rate.

Note that the actual object algorithm implements a direct-form FIR polyphase structure, an efficient equivalent of the combined system depicted in the diagram. For more details, see Algorithms.

This object supports C and C++ code generation.

To implement the variable FIR interpolator:

Create the

`dsp.VariableFIRInterpolator`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

## Creation

### Syntax

### Description

returns a variable FIR interpolator object with a maximum interpolation factor of 24. The
object designs the FIR filter using `varFIRInterp`

= dsp.VariableFIRInterpolator`designMultirateFIR(24,1)`

.

sets the `varFIRInterp`

= dsp.VariableFIRInterpolator(`L`

)_{max}`MaxInterpolationFactor`

property to
*L _{max}*.

sets the `varFIRInterp`

= dsp.VariableFIRInterpolator(`L`

,_{max}`L`

)`InterpolationFactor`

property to *L*. The
object designs the FIR filter using
`designMultirateFIR`

(*L*,1). The designed filter
corresponds to a lowpass filter with a cutoff at π/*L* in radial
frequency units.

returns a variable FIR interpolator object with additional properties specified by one or
more name-value arguments. For example, `varFIRInterp`

= dsp.VariableFIRDecimator(`Name=Value`

)```
varFIRInterp =
dsp.VariableFIRInterpolator(Specification="Output frame length")
```

creates a
variable FIR interpolator object with an output frame length of 48.

## Properties

## Usage

### Description

### Input Arguments

### Output Arguments

## Object Functions

To use an object function, specify the
System object™ as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

## Examples

## Algorithms

The FIR interpolation filter is implemented efficiently using a polyphase structure.

To derive the polyphase structure, start with the transfer function of the FIR filter

$$H(z)={b}_{0}+{b}_{1}{z}^{-1}+\mathrm{...}+{b}_{N}{z}^{-N},$$

where *N*+1 is the length of the FIR filter.

You can rearrange this equation as

$$H(z)=\begin{array}{c}\left({b}_{0}+{b}_{{L}_{\mathrm{max}}}{z}^{-{L}_{\mathrm{max}}}+{b}_{2{L}_{\mathrm{max}}}{z}^{-2{L}_{\mathrm{max}}}+\mathrm{...}+{b}_{N-{L}_{\mathrm{max}}+1}{z}^{-(N-{L}_{\mathrm{max}}+1)}\right)+\\ {z}^{-1}\left({b}_{1}+{b}_{{L}_{\mathrm{max}}+1}{z}^{-{L}_{\mathrm{max}}}+{b}_{2{L}_{\mathrm{max}}+1}{z}^{-2{L}_{\mathrm{max}}}+\mathrm{...}+{b}_{N-{L}_{\mathrm{max}}+2}{z}^{-(N-{L}_{\mathrm{max}}+1)}\right)+\\ \begin{array}{c}\vdots \\ {z}^{-({L}_{\mathrm{max}}-1)}\left({b}_{{L}_{\mathrm{max}}-1}+{b}_{2{L}_{\mathrm{max}}-1}{z}^{-{L}_{\mathrm{max}}}+{b}_{3{L}_{\mathrm{max}}-1}{z}^{-2{L}_{\mathrm{max}}}+\mathrm{...}+{b}_{N}{z}^{-(N-{L}_{\mathrm{max}}+1)}\right),\end{array}\end{array}$$

where *L _{max}* is the number of
polyphase components, and its value equals the maximum interpolation factor.

You can write *H*(z) as

$$H(z)={E}_{0}({z}^{{L}_{\mathrm{max}}})+{z}^{-1}{E}_{1}({z}^{{L}_{\mathrm{max}}})+\mathrm{...}+{z}^{-({L}_{\mathrm{max}}-1)}{E}_{({L}_{\mathrm{max}}-1)}({z}^{{L}_{\mathrm{max}}}),$$

where
*E _{0}(z^{Lmax})*,

*E*, ...,

_{1}(z^{Lmax})*E*are polyphase components of the FIR filter

_{Lmax-1}(z^{Lmax})*H*(z).

During simulation, the algorithm reconstructs the filter *H*(z) based on the current interpolation factor *L*.

Rewriting *H*(z) in terms of the interpolation factor *L* yields

$$H(z)={E}_{0}({z}^{L})+{z}^{-1}{E}_{r}({z}^{L})+\mathrm{...}+{z}^{-(L-1)}{E}_{(L-1)r}({z}^{L}),$$

where *r* =
*L _{max}*/

*L*.

Conceptually, the FIR interpolation filter contains an upsampler followed by an FIR lowpass filter *H*(z).

Replace *H*(z) with its polyphase representation.

This is the multirate noble identity for interpolation.

Applying the noble identity for interpolation moves the upsampling operation to after the filtering operation. This move enables you to filter the signal at a lower rate.

You can replace the upsampling operator, delay block, and adder with a commutator switch. The switch starts on the first branch 0 and moves in the counterclockwise direction, each time receiving one sample from each branch. The interpolator effectively outputs *L* samples for every one input sample it receives. Hence the sample rate at the output of the FIR interpolation filter is *Lfs*.

## References

[1] Orfanidis, Sophocles J.
*Introduction to Signal Processing*. Upper Saddle River, NJ:
Prentice-Hall, 1996.

## Extended Capabilities

## Version History

**Introduced in R2024b**