Package: dsp
Static or timevarying digital filter
Note:

The DigitalFilter
object filters each channel
of the input using static or timevarying digital filter implementations.
To filter each channel of the input using digital filter implementation:
Define and set up your IIR digital filter. See Construction.
Call step
to filter each channel
according to the properties of dsp.DigitalFilter
.
The behavior of step
is specific to each object in
the toolbox.
Note:
Starting in R2016b, instead of using the 
H = dsp.DigitalFilter
returns
a default IIR digital filter object, H
, which independently
filters each channel of the input over successive calls to the step
method,
using a specified digital filter implementation. The default numerator
coefficients are [1 2]
and denominator coefficients
are [1 0.1]
.
H = dsp.DigitalFilter('
returns a digital filter object, PropertyName
',PropertyValue
,
...)H
,
with each property set to the specified value.

Type of filter transfer function Specify the type of digital filter transfer function as one
of   

Filter structure Specify the filter structure.
 

Source of filter coefficients Specify the source of the filter coefficients as one of   

Numerator coefficients Specify the filter numerator coefficients as a real or complex
numeric vector. This property applies when you set the  

Denominator coefficients Specify the filter denominator coefficients as a real or complex
numeric vector. This property applies when you set the  

Reflection coefficients of lattice filter structure Specify the reflection coefficients of a lattice filter as a
real or complex numeric vector. This property applies when you set
the  

SOS matrix of biquad filter structure Specify the secondorder section (SOS) matrix of a biquad filter
as an Mby6 matrix, where M is
the number of sections in the filter. Each row of the SOS matrix contains
the numerator and denominator coefficients of the corresponding filter
section. The first three elements of each row are the numerator coefficients
and the last three elements are the denominator coefficients. You
can use real or complex coefficients. This property applies when you
set the  

Scale values of biquad filter structure Specify the scale values to apply before and after each section
of a biquad filter.  

Assume first denominator coefficient is 1 Setting this Boolean property to This property applies when you set the  

Initial conditions for all poles or all zeros filter Specify the initial conditions of the filter states. When the You can specify the initial conditions as a scalar, vector, or matrix. If you specify a scalar value, the digital filter object initializes all delay elements in the filter to that value. If you specify a vector whose length equals the number of delay elements in the filter, each vector element specifies a unique initial condition for the corresponding delay element. The object applies the same vector of initial conditions to each channel of the input signal. If you specify a vector whose length equals the product of the number of input channels and the number of delay elements in the filter, each element specifies a unique initial condition for the corresponding delay element in the corresponding channel. If you specify a matrix with the same number of rows as the
number of delay elements in the filter, and one column for each channel
of the input signal, each element specifies a unique initial condition
for the corresponding delay element in the corresponding channel.
This property applies when you do not set the  

Initial conditions on zeros side Specify the initial conditions of the filter states on the side
of the filter structure with the zeros. This property applies when
you set the  

Initial conditions on poles side Specify the initial conditions of the filter states on the side
of the direct form I (noncanonic) filter structure with the poles.
This property applies when you set the 
clone  Create static or timevarying digital filter with same property values 
getNumInputs  Number of expected inputs to step method 
getNumOutputs  Number of outputs of step method 
isLocked  Locked status for input attributes and nontunable properties 
release  Allow property value and input characteristics changes 
reset  Reset internal states of digital filter 
step  Filter input with digital filter object 
Use an FIR filter to apply a low pass filter to a waveform with two sinusoidal components:
t = [0:63]./32e3; xin = (sin(2*pi*4e3*t)+sin(2*pi*12e3*t)) / 2; hSR = dsp.SignalSource(xin', 4); hLog = dsp.SignalSink; hFilt = dsp.DigitalFilter; hFilt.TransferFunction = 'FIR (all zeros)'; hFilt.Numerator = fir1(10,0.5); while ~isDone(hSR) input = step(hSR); filteredOutput = step(hFilt,input); step(hLog,filteredOutput); end filteredResult = hLog.Buffer; periodogram(filteredResult,[],[],32e3)
This object implements the algorithm, inputs, and outputs described on the Digital Filter block reference page. The object properties correspond to the block parameters.
This object processes inputs only as frames of data. The block lets you specify whether to process inputs as individual samples or as frames of data . You use the Input processing parameter on the block.
dsp.AllpoleFilter
 dsp.BiquadFilter
 dsp.FIRFilter
 dsp.IIRFilter