dsphdl.BiquadFilter
Description
A biquad filter is a form of infinite-impulse response (IIR) filter where the numerator and denominator are split into a series of second-order sections connected by gain blocks. This type of filter can replace a large FIR filter that uses an impractical amount of hardware resources. Designs often use biquad filters as DC blocking filters or to meet a specification originally implemented with an analog filter, such as a pre-emphasis filter.
To filter input data with an HDL-optimized biquad filter:
- Create the - dsphdl.BiquadFilterobject 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?
Note
You can also generate HDL code for this hardware-optimized algorithm, without creating a MATLAB® script, by using the DSP HDL IP Designer app. The app provides the same interface and configuration options as the System object™.
Creation
Description
myfilt = dsphdl.BiquadFilter
myfilt = dsphdl.BiquadFilter(Name,Value)
For example:
myfilt = dsphdl.BiquadFilter('Structure','Direct form II transposed', ... 'OutputDataType','Custom', ... 'CustomOutputDataType',numerictype(1,16,14)); [dataOut,validOut] = myfilt(dataIn,validIn);
Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their
        values after calling the object. Objects lock when you call them, and the
        release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
Both the 'Direct form II' and 'Direct form II
              transposed' architectures are pipelined and quantized to fit well into FPGA
            DSP blocks. The output of these filters matches the output of the DSP System Toolbox™ System objects dsp.SOSFilter
            and dsp.FourthOrderSectionFilter. These architectures minimize the number of
            multipliers used by the filter but have a critical path through the feedback loop and
            sometimes cannot achieve higher clock rates. These architectures do not support vector
            input.
'Pipelined feedback form' implements a pipelined architecture
            that uses more multipliers than either direct form II structure, but achieves higher
            clock rates after synthesis. Vector input is supported only when you use
              'Pipelined feedback form'. The output of the pipelined filter is
            slightly different than the DSP System Toolbox functions dsp.SOSFilter
            and dsp.FourthOrderSectionFilter because of the timing of data samples applied
            in the pipelined filter stages.
'Direct form I fully serial' implements a fully serial
            architecture that uses only one multiplier. When you select this option, the object
            stores the numerator, denominator, and scale values in the same ROM. You can control the
            data type of the ROM by using the CoefficientDataType property.
            When you select this architecture, the object has an output ready
            argument. The ready argument indicates when the object is ready for
            new input data. Apply input data only when ready is
              1 (true). This architecture does not support
            vector input.
Specify the numerator coefficients as a matrix of NumSections-by-3 values. NumSections is the number of second-order filter sections. The object infers the number of filter sections from the size of the numerator and denominator coefficients. The numerator coefficient and denominator coefficient matrices must be the same size. The default filter has one section.
Specify the denominator coefficients as a matrix of
            NumSections-by-3 values. The object assumes the first denominator
            coefficient of each section is 1.0.NumSections is
            the number of second-order filter sections. The object infers the number of sections
            from the size of the numerator and denominator coefficients. The numerator coefficient
            and denominator coefficient matrices must be the same size. The default filter has one
            section.
Specify the gain values as a vector of up to NumSections+1 values. NumSections is the number of second-order filter sections. The object infers the number of sections from the size of the numerator and denominator coefficients. If the vector has only one value, the object applies that gain before the first section. If you specify fewer values than there are filter sections, the object sets the remaining section gain values to one. The diagram shows a 3-section filter and the locations of the four scale values before and after the sections.

Implementing these gain factors outside the filter sections reduces the multipliers needed to implement the numerator of the filter.
Data Types
Rounding mode for type-casting the output and accumulator values to the data types
              specified by the OutputDataType and
                AccumulatorDataType properties. When the input data type is
              floating point, the object ignores this parameter. For more details, see Rounding Modes.
Overflow handling for type-casting the output and accumulator values to the data
              types specified by the OutputDataType and
                AccumulatorDataType properties. When the input data type is
              floating point, the object ignores the OverflowAction property.
              For more details, see Overflow Handling.
Data type of numerator coefficients, specified as 'Same word length as
                input' or 'Custom'. 
The object type-casts the numerator coefficients to the specified data type. The quantization rounds to the nearest representable value and saturates on overflow. When the input data type is floating point, the object ignores this property.
The object returns a warning if the data type of the coefficients does not have enough fractional length to represent the coefficients accurately.
Dependencies
To enable this property, set the Structure property to
                  'Direct form II', 'Direct form II
                  transposed', or 'Pipelined feedback form'.
Data type of denominator coefficients, specified as 'Same word length
                input' or 'Custom'. 
The object type-casts the denominator coefficients to the specified data type. The quantization rounds to the nearest representable value and saturates on overflow. When the input data type is floating point, the object ignores this property.
The object returns a warning if the data type of the coefficients does not have enough fractional length to represent the coefficients accurately.
Dependencies
To enable this property, set the Structure property to
                  'Direct form II', 'Direct form II
                  transposed', or 'Pipelined feedback form'.
Data type of the scale values, specified as 'Same word length as
                input' or 'Custom'.
The object type-casts the scale values to the specified data type. The quantization rounds to the nearest representable value and saturates on overflow. When the input data type is floating point, the object ignores this property.
Dependencies
To enable this property, set the Structure property to
                  'Direct form II', 'Direct form II
                  transposed', or 'Pipelined feedback form'.
Data type of the scale values, specified as 'Same word length as
                input' or 'Custom'.
The object casts the numerator, denominator, and scale values to this data type and stores them in an eight-element memory of this word length. The quantization rounds to the nearest representable value and saturates on overflow. When the input data type is floating point, the object ignores this property.
Dependencies
To enable this property, set the Structure property to
                  'Direct form I fully serial'.
Data type of accumulator signals within each section (as indicated in the diagrams
              in the Algorithms section),
              specified as 'Same as first input', or
              'Custom'.
The object type-casts the output of the filter to the specified data type. The
              quantization uses the settings of the RoundingMethod and
                OverflowAction properties. When the input data type is floating
              point, the object ignores this property.
Data type of filter output, specified as 'Same as first input',
                'Full precision', or 'Custom'.
The object type-casts the output of the filter to the specified data type. The
              quantization uses the settings of the RoundingMethod and
                OverflowAction properties. When the input data type is floating
              point, the object ignores this property.
Data type of numerator coefficients, specified as a numerictype object. To specify a numerictype object,
              call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
The object type-casts the numerator coefficients to the specified data type. The quantization rounds to the nearest representable value and saturates on overflow. When the input data type is floating point, the object ignores this property.
The object returns a warning if the data type of the coefficients does not have enough fractional length to represent the coefficients accurately.
Dependencies
This property applies when you set the NumeratorDataType
                property to 'Custom'.
Data type of denominator coefficients, specified as a numerictype object. To specify a numerictype object,
              call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
Dependencies
This property applies when you set the DenominatorDataType
                property to 'Custom'.
Data type of the scale values, specified as 'Same word length as first
                input' or a numerictype object. To specify a
                numerictype object, call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
Dependencies
This property applies when you set the ScaleValuesDataType
                property to 'Custom'.
Data type of coefficient memory when using serial architecture, specified as a
                numerictype object. To specify a
                numerictype object, call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
The object casts the numerator, denominator, and scale values to this data type and stores them in an eight-element memory of this word length.
Dependencies
This property applies when you set the CoefficientDataType
                property to 'Custom'.
Data type of accumulator signals within each section (as indicated in the diagrams
              in the Algorithms section),
              specified as a numerictype object. To specify a
                numerictype object, call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
Dependencies
This property applies when you set the AccumulatorDataType
                property to 'Custom'.
Data type of filter output, specified as a numerictype object. To specify a numerictype object,
              call numerictype(s,w,f), where:
- sis- 1for signed and- 0for unsigned.
- wis the word length in bits.
- fis the number of fractional bits.
Dependencies
This property applies when you set the OutputDataType
                property to 'Custom'.
Usage
Description
Input Arguments
Input data, specified as a scalar or column vector of real values. When the input has an integer or fixed-point data type, the object uses fixed-point arithmetic for internal calculations.
Vector input is supported only when you set the Structure
              property to 'Pipelined feedback form'. The object accepts vectors
              up to 64 samples, but large vector sizes can make the calculation of internal data
              types challenging. Vector sizes of up to 16 samples are practical for hardware
              implementation.
When you set the Structure property to 'Direct form
                I fully serial', the object has an output ready
              argument that indicates when the object is ready for new input. You can apply input
              data only when the output ready argument is 1
                (true). Your design can react to the ready
              argument to provide the next input sample, or you can space your input data with
              enough cycles in between to process each sample. Use the validOut
              argument to determine the cycles required to process one sample.
The software supports double and
        single data types for simulation, but not for HDL code generation.
Data Types: fi | single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Control signal that indicates if the input data is valid. When
                validIn is 1 (true), the
              object captures the values from the dataIn argument. When
                validIn is 0 (false), the
              object ignores the values from the dataIn argument.
Data Types: logical
Output Arguments
Filtered output data, returned as a scalar or column vector of real values. The
              output dimensions match the input dimensions. When the input data is floating point,
              the output data inherits the data type of the input data. When the input data is an
              integer type or fixed-point type, the OutputDataType property
              determines the output data type.
Data Types: fi | single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Control signal that indicates if the output data is valid. When
                validOut is 1 (true), the
              object returns valid data from the dataOut argument. When
                validOut is 0 (false),
              values from the dataOut argument are not valid.
Data Types: logical
Control signal that indicates that the object is ready for new input data sample
              on the next call. When ready is 1
                (true), you can specify the dataIn and validIn inputs for the next
              time step. When ready is 0
                (false), the object ignores any input data in the next time step. 
When using the 'Direct form I fully serial' architecture, the
              object processes one sample at a time. If your design waits for the object to return
                ready set to 0 (false)
              before stopping the application of input data, then one additional input data value
              arrives at the object. The object stores this additional data while processing the
              current data, and does not set ready to 1
                (true) until the additional input is processed.
Dependencies
To enable this argument, set the Structure property to
                  'Direct form I fully serial'.
Data Types: logical
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)
| getLatency | Latency of biquad filter | 
| filterAnalyzer | Analyze filters with Filter Analyzer app | 
Algorithms
This System object implements the algorithms described on the Biquad Filter block reference page.
Extended Capabilities
This System object supports C/C++ code generation for accelerating MATLAB simulations, and for DPI component generation.
The software supports double and
        single data types for simulation, but not for HDL code generation.
To generate HDL code from predefined System objects, see Generate HDL Code for IIR Filter.
Version History
Introduced in R2022aYou can import this filter System object into the Filter Analyzer app, or
        use it as input to the filterAnalyzer
        function.
The object now has the option to set the Structure property to
          'Direct form I fully serial' to implement a fully serial architecture
        that uses only one multiplier. When you select this option, the object stores the numerator,
        denominator, and scale values in the same ROM, and you can control the data type of the ROM
        by using the CoefficientDataType property. When you select this
        architecture, the object has an output ready argument that indicates
        when the object is ready for new input. You can apply input data only when the output
          ready argument is 1
        (true).
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)