Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Discrete-time filter

`Hd = dfilt.`

* structure*(input1,...)

`Hd = dfilt.`

returns
a discrete-time filter, * structure*(input1,...)

`Hd`

, of type `structure`

`dfilt`

.`structure`

You must use a * structure* with

`dfilt`

. `Hd = [dfilt.`

returns
a vector containing * structure*(input1,...),dfilt.

`structure`

`dfilt`

filters. Available structures for the `dfilt`

object
are shown below. The target block for the `block`

method
depends on the filter structure. Depending on the target block, the DSP System
Toolbox™ software
may be required.

dfilt.structure | Description | Coefficient Mapping Support in realizemdl | Target Filter Block for |
---|---|---|---|

Delay | Not supported | `Delay` Requires DSP System Toolbox | |

Direct-form I | Supported | `Discrete Filter` | |

Direct-form I, second-order sections | Supported | `Discrete Filter` Requires DSP System Toolbox | |

Direct-form I transposed | Supported | `Discrete Filter` | |

Direct-form I transposed, second-order sections | Supported | `Biquad Filter ` Requires DSP System Toolbox | |

Direct-form II | Supported | `Discrete Filter` | |

Direct-form II, second-order sections | Supported | `Discrete Filter` | |

Direct-form II transposed | Supported | `Discrete Filter` | |

Direct-form II transposed, second-order sections | Supported | `Biquad Filter ` Requires DSP System Toolbox | |

Direct-form FIR | Supported | `Discrete FIR Filter ` | |

Direct-form FIR transposed | Supported | `Discrete FIR Filter ` | |

Direct-form symmetric FIR | Supported | `Discrete FIR Filter ` | |

Direct-form antisymmetric FIR | Supported | `Discrete FIR Filter ` | |

Overlap-add FIR | Not supported | `Overlap-Add FFT Filter` Requires DSP System Toolbox | |

Lattice allpass | Supported | Not supported | |

Lattice autoregressive (AR) | Supported | `Allpole Filter` Requires DSP System Toolbox | |

Lattice autoregressive moving- average (ARMA) | Supported | Not supported | |

Lattice moving-average (MA) for maximum phase | Supported | Not supported | |

Lattice moving-average (MA) for minimum phase | Supported | `Discrete FIR Filter` | |

State-space | Supported. | Not supported | |

Scalar gain object | Supported | `Gain` Requires DSP System Toolbox | |

Filters arranged in series | Supported | Target blocks depend on filter structures in the series | |

Filters arranged in parallel | Supported | Target blocks depend on filter structures in the parallel system |

For more information on each structure, use the syntax ```
help
diflt.
```

* structure* at the MATLAB

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.

If your variable is a 1-D array of `dfilt`

filters,
the method is applied to each object in the array. Only `freqz`

, `grpdelay`

, `impz`

, `is`

*, `order`

,
and `stepz`

methods can be applied to arrays. The `zplane`

method
can be applied to an array only if it is used without outputs.

Some of the methods listed below have the same name as Signal
Processing Toolbox™ functions
and they behave similarly. This is called *overloading* of
functions.

Available methods are:

Method | Description |
---|---|

Adds a stage to a | |

The
| |

Returns the series combination of two | |

Returns the filter coefficients in a structure containing
fields that use the same property names as those in the original | |

Converts a | |

Writes a filter coefficient ASCII file. The file can
contain a single filter or a vector of objects. Default filename is
| |

Returns the frequency-domain coefficients used when filtering
with a | |

Performs filtering using the
| |

Returns the type (1-4) of a linear phase FIR filter. | |

Plots the frequency response in | |

Plots the group delay in | |

Plots the impulse response in | |

Returns the length of the impulse response. | |

Displays brief | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns a logical | |

Returns the number of sections in a second-order sections
filter. If a multistage filter contains stages with multiple sections,
using | |

Returns the number of stages of the filter, where a stage is a separate, modular filter. | |

Returns the number of states for an object. | |

Returns the filter order. If | |

Returns the parallel combination of two | |

Plots the phase response in | |

(Available only with Simulink software.)
The following properties are available:
The
following properties optimize the block structure. Specifying
| |

Removes a stage from a cascade or parallel | |

Overwrites a stage of a cascade or parallel | |

Converts the
| |

Converts the | |

Plots the step response in
| |

Converts the | |

Converts the | |

Plots the zero-phase response in | |

Converts the | |

Plots a pole-zero plot in |

For more information on each method, use the syntax ```
help
diflt/
```

* method* at the MATLAB prompt.

As with any object, you can use `get`

to view
a `dfilt`

properties. To see a specific property,
use

get(Hd,'property')

To see all properties for an object, use

get(Hd)

To set specific properties, use

set(Hd,'property1',value,'property2',value,...)

Note that you must use single quotation marks around the property name.

Alternatively, you can get or set a property value with `Object.property`

:

b = [0.05 0.9 0.05]; Hd = dfilt.dffir(b); % Lowpass direct-form I FIR filter Hd.arithmetic % get arithmetic property % returns double Hd.arithmetic = 'single'; % Set arithmetic property to single precision

To create a copy of an object, use the `copy`

method.

H2 = copy(Hd)

Using the syntax `H2 = Hd`

copies
only the object handle and does not create a new object.

To change the filter structure of a `dfilt`

object `Hd`

,
use

Hd2=convert(Hd,'structure_name');

where `structure_name`

is any valid structure
name in single quotes. If `Hd`

is a `cascade`

or `parallel`

structure,
each of its stages is converted to the new structure.

Two properties control the filter states:

`states`

— stores the current states of the filter. Before the filter is applied, the states correspond to the initial conditions and after the filter is applied, the states correspond to the final conditions. For`df1`

,`df1t`

,`df1sos`

and`df1tsos`

structures,`states`

returns a`filtstate`

object.`PersistentMemory`

— controls whether filter`states`

are saved. The default value is`'false'`

, which causes the initial conditions to be reset to zero before filtering and turns off the display of`states`

information. Setting`PersistentMemory`

to`'true'`

allows the filter to use your initial conditions or to reuse the final conditions of a previous filtering operation as the initial conditions of the next filtering operation. It also displays information about the filter`states`

.### Note

If you set

`states`

and want to use them for filtering, you must set`PersistentMemory`

to`'true'`

before you use the filter.

Create a direct-form I filter and use a method to see if it is stable.

[b,a] = butter(8,0.25); Hd = dfilt.df1(b,a)

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

get(Hd,'numerator')

or alternatively

Hd.numerator

Refer to the reference pages for each structure for more examples.

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

| `step`

| `tf`

| `zpk`

| `zplane`

Was this topic helpful?