Filter Design Toolbox    
qfilt

Construct a quantized filter

Syntax

Description

Hq = qfilt creates a quantized filter Hq with default property settings. The default settings for Hq imply Hq is a fixed-point quantized filter with a transposed direct form II filter structure. All of the filter properties, along with their default values are listed in Quantized Filter Properties Reference.

Hq = qfilt('Structure',{Coef}) creates a quantized filter Hq with all properties set to default values, except that the filter structure is specified by the string 'Structure', and the reference filter parameters (the ReferenceCoefficients property values) are specified in the cell array {Coef}. The syntax for entering reference coefficients is specified in Specifying the Filter Reference Coefficients. 'Structure' can be one of the strings for the FilterStructure property values listed in the following table.

Table 13-4: Filter Structure Properties 
Property Value String
Description
'df1'
Direct form I
'df1t'

Direct form I transposed

'df2'
Direct form II
'df2t'
Direct form II transposed
'fir'
Finite impulse response (FIR)
'firt'
Finite impulse response transposed
'antisymmetricfir'
Direct form antisymmetric FIR, available odd or even
'symmetricfir'
Direct form symmetric FIR, available odd or even
'latticear'
Lattice autoregressive (AR)
'latticema'
Lattice moving average (MA)
'latticearma'
Lattice ARMA
'latticeca'
Lattice coupled-allpass
'latticecapc'
Lattice coupled-allpass power complementary
'statespace'
Single-input, single-output state-space

Hq = qfilt('prop1',value1,'prop2',value2,...) creates a quantized filter Hq with all properties set to the default values, except for those you specify with the input string arguments 'prop1', 'prop2',..., along with the corresponding values in value1, value2,.... Filter properties you can set, with their default values, are listed in Quantized Filter Properties Reference. Any properties that you do not explicitly set when you create the quantized filter are assigned default values.

You can also use the shortcut

by first specifying the FilterStructure property value as 'Structure' and the reference filter parameters (the ReferenceCoefficients property values) in the cell array {Coef}.

Hq = qfilt('quantizer',[13 14] sets all the data format properties for quantized filter Hq to the same word length and fraction length.

Examples

Example 1: Quantized Filter with Two Second-Order Sections

From a reference filter, create a fixed-point quantized filter Hq that has two second-order sections, setting the rounding mode to 'fix' and displaying the results.

Example 2: Quantized Filter from Table of Filter Coefficients

In this example, you create a sixth-order quantized filter from filter coefficients in a reference table.

Enter the filter coefficients from a table of coefficients. The following coefficients represent a 6-pole Chebyshev high pass filter, with 0.5% ripple in the passband and cutoff at 0.25 in normalized frequency.

Numerator:

Denominator:

Create a quantized filter using the reference coefficients b and a.

Eliminate the overflows by normalizing the coefficients.

You have a sixth-order, high pass filter with no overflowing coefficients.

Some things to think about when you use coefficients from a table.

Example 3: Comparing Fixed-Point and Floating-Point Filters

To demonstrate the effect of filtering a signal with a quantized filter that has a leading zero in the denominator coefficients, this example creates a default quantized filter, then changes the reference coefficients to be numerator=1 and denominator=0.

q is a fixed-point quantized filter with references coefficients of b=1 and a=0. Now filter a signal with q and look at the results.

In two's complement fixed-point format, NaNs and Infs cannot be represented. When the division by zero occurs during the filtering process, which happens when the leading coefficient in the denominator is zero, the result saturates to (1-215). The direct form filter structures, such as df1 and df2t, demonstrate this behavior when they have leading zeros in the denominator.

When you change the filter mode to 'float' from 'fixed', the results return as Inf, as you should expect.

Changing the mode results in Inf because IEEE floating-point arithmetic returns Inf as the result of a division by zero operation.

See Also
get, set, setbits


  qfft qfilt2tf 

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS