Signal Processing Toolbox | ![]() ![]() |
Construct a discrete-time, filter object
Syntax
Description
Hd = dfilt.
returns a discrete-time filter object, structure
Hd
, of type structure
. You must use a structure with dfilt
. Each structure takes one or more inputs. If you specify a dfilt
.structure
with no inputs, a default filter is created.
Structures
Structures
for dfilt
specify the type of filter structure. Available structures
for dfilt
are shown below.
dfilt.structure
Description
dfilt.df1
Direct form I
dfilt.df1sos
Direct form I, second-order sections
dfilt.df1t
Direct form I transposed
dfilt.df1tsos
Direct form I transposed, second-order sections
dfilt.df2
Direct form II
dfilt.df2sos
Direct form II, second-order sections
dfilt.df2t
Direct form II transposed
dfilt.df2tsos
Direct form II transposed, second-order sections
dfilt.dffir
Direct form FIR
dfilt.dffirt
Direct form FIR transposed
dfilt.dfsymfir
Direct form symmetric FIR
dfilt.dfasymfir
Direct form antisymmetric FIR
dfilt.latticeallpass
Lattice allpass
dfilt.latticear
Lattice autoregressive (AR)
dfilt.latticearma
Lattice auto-regressive moving- average (ARMA)
dfilt.latticemamax
Lattice moving average (MA) for maximum phase
dfilt.latticemamin
Lattice moving average (MA) for minimum phase
dfilt.calattice
Coupled, allpass lattice (available only with the Filter Design Toolbox)
dfilt.calatticepc
Coupled, allpass lattice with power complementary output (available only with the Filter Design Toolbox)
dfilt.statespace
State-space
dfilt.cascade
dfilt
objects arranged in seriesdfilt.parallel
dfilt
objects arranged in parallel
For more information on each structure, refer to its reference page.
Methods
Methods provide ways of performing functions directly on your dfilt
object without having to specify the filter parameters again. You can apply these methods directly on the variable you assigned to your dfilt
object.
For example, if you create a dfilt
object, Hd
, you can check whether it has linear phase with islinphase(Hd)
, view its frequency response plot with fvtool(Hd),
or obtain its frequency response values with h=freqz(Hd)
. You can use all of the methods below in this way.
Some of these methods have the same name as functions in the Signal Processing Toolbox and they behave similarly. This is called overloading of functions.
Method |
Description |
addsection |
Adds a section to a cascade or parallel object. See |
cascade |
Returns the series combination of two |
coefficients |
Returns the filter coefficients. |
filter |
Performs filtering using the dfilt object. |
convert |
Converts a dfilt object from one filter structure to another filter structure. |
freqz |
Returns the frequency response in fvtool . |
grpdelay |
Returns the group delay in fvtool . |
impz |
Returns the impulse response in fvtool . |
Returns 1 if the dfilt object has allpass filter sections or 0 if it does not. |
|
Returns 1 if the dfilt object is cascaded or 0 if it is not. |
|
Returns 1 if the dfilt object has finite impulse response (FIR) or 0 if it does not. |
|
Returns 1 if the dfilt object has linear phase sections or 0 if it does not. |
|
ismaxphase |
Returns 1 if the dfilt object has maximum-phase sections or 0 if it does not. |
isminphase |
Returns 1 if the dfilt object has minimum-phase sections or 0 if it does not. |
isparallel |
Returns 1 if the dfilt object has parallel sections or 0 if it does not. |
isreal |
Returns 1 if the dfilt object has real-valued coefficient or 0 if it does not. |
Returns 1 if the dfilt object is scalar or 0 if it is not scalar. |
|
Returns 1 if the dfilt object has second-order sections or 0 if it does not. |
|
Returns 1 if all sections of the dfilt object are stable or 0 if they are not. |
|
nstates |
Returns the number of states for state-space objects. |
order |
Returns the filter order. If Hd is a single-section filter, the order is given by the number of delays needed for a minimum realization of the filter. If Hd has multiple sections, the order is given by the the number of delays needed for a minimum realization of the overall filter. |
Returns the parallel combination of two |
|
(Available only with the DSP Blockset.)
The following properties are available.
The following properties optimize the block structure. Specifying the value
|
|
Removes a section from a cascade or parallel object. See |
|
Overwrites a section of a cascade or parallel object. See dfilt.cascade and dfilt.parallel . |
|
Converts the object to a second-order sections object. If Hd has a single section, the returned filter has the same class.sos(Hd,flag) specifies the ordering of the second-order sections. If flag='UP' , the first row contains the poles closest to the origin, and the last row contains the poles closest to the unit circle. If flag='down' , the sections are ordered in the opposite direction. The zeros are always paired with the poles closest to them.sos(Hd,flag,scale) specifies the scaling of the gain and the numerator coefficients of all second-order sections. scale can be 'none' , 'inf' (infinity-norm) or 'two' (2-norm). Using infinity-norm scaling with up ordering minimizes the probability of overflow in the realization. Using 2-norm scaling with down ordering minimizes the peak roundoff noise. |
|
Converts the object to state-space. To see the separate A,B,C,D matrices for the state-space model, use [A,B,C,D]=ss(Hd). |
|
stepz |
Returns the step response in fvtool .stepz(Hd,n) computes the first n samples of the step response.stepz(Hd,n,Fs) separates the time samples by T = 1/Fs , where Fs is assumed to be in Hz. |
tf |
Converts the object to a transfer function. |
Converts the object to zeros-pole-gain form. |
|
Returns a pole-zero plot in fvtool . |
Viewing Object Parameters
As with any object, you can use get
to view a dfilt
object's parameters. To see a specific parameter, use
To see all parameters for an object, use
You can also view the names of the parameters that hold the filter coefficients with
Changing Object Parameters
To set specific parameters, use
Note that you must use single quotation marks around the parameter name.
Converting Between Filter Structures
To change the filter structure of a dfilt
object Hd
, use
where structure_string
is any valid structure name in single quotation marks. If Hd
is a cascade
or parallel
structures, each of its sections is converted to the new structure.
Copying an Object
To create a copy of an object, use the copy method.
Using the syntax H2 = Hd
copies only the object handle and does not create a new object.
Examples
Create a direct form I filter object and use a method to see if it is stable:
[b,a] = butter(8,0.25); Hd = dfilt.df1(b,a) Hd = FilterStructure: 'Direct form I' Numerator: [1x9 double] Denominator: [1 -3.9838 7.5362 -8.5998 6.4002 -3.1560 1.0017 -0.1863 0.0155] isstable(Hd) ans = 1
If a dfilt
's numerator values do not fit on a single line, a description of the vector is displayed. To see the specific numerator values for this example, use
Refer to the reference pages for each structure for more examples.
See Also
dfilt.cascade
, dfilt.df1
, dfilt.df1t
, dfilt.df2
, dfilt.df2t
, dfilt.dfasymfir
, dfilt.dffir
, dfilt.dffirt
, dfilt.dfsymfir
, dfilt.latticeallpass
, dfilt.latticear
, dfilt.latticearma
, dfilt.latticemamax
, dfilt.latticemamin
, dfilt.parallel
, dfilt.statespace
, filter
, freqz
, grpdelay
, impz
, sos
, step
, tf
, zpk
, zplane
![]() | demod | dfilt.cascade | ![]() |