Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

cost

Estimate cost of discrete-time or multirate filter

Syntax

c = cost(hd)
c = cost(hs)
c = cost(hs,Name,Value)

Description

c = cost(hd) returns a cost estimate c for the discrete-time filter hd.

c = cost(hs) returns a cost estimate c for the filter System object™ hs.

c = cost(hs,Name,Value) returns a cost estimate c for the filter System object hs with additional options specified by one or more Name,Value pair arguments.

Input Arguments

collapse all

hd

Discrete-time dfilt filter object.

hs

Filter System object.

All filter system objects support analysis methods. For more information on analysis methods, see Analysis Methods for Filter System Objects. For a list of analysis methods supported by a particular filter System object, for example dsp.FIRHalfbandDecimator, enter dsp.FIRHalfbandDecimator.helpFilterAnalysis at the MATLAB® Command prompt.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

collapse all

For filter System object inputs only, specify the arithmetic used during analysis. When you specify 'double' or 'single', the function performs double- or single-precision analysis. When you specify 'fixed' , the arithmetic changes depending on the setting of the CoefficientDataType property and whether the System object is locked or unlocked.

 Details for Fixed-Point Arithmetic

When you do not specify the arithmetic for non-CIC structures, the function uses double-precision arithmetic if the filter System object is in an unlocked state. If the System object is locked, the function performs analysis based on the locked input data type. CIC structures only support fixed-point arithmetic.

Output Arguments

c

Cost estimate. c has the following fields if input is a discrete-time filter or a multirate filter object.

Estimated Value

Field Name

Description

Number of Multiplications

nmult

Number of multiplications during the filter run. nmult ignores multiplications by -1, 0, and 1 in the total multiple.

Number of Additions

nadd

Number of additions during the filter run.

Number of States

nstates

Number of states the filter uses.

Multiplications per Input Sample

multperinputsample

Number of multiplication operations performed for each input sample

Additions per Input Sample

addperinputsample

Number of addition operations performed for each input sample

c is a structure with the following fields if input is a filter System object.

Estimated Value

Description

NumCoefficients

Number of filter coefficients.

NumStates

Number of filter states.

MultiplicationsPerInputSample

Number of multiplication operations performed for each input sample

AdditionsPerInputSample

Number of addition operations performed for each input sample

Examples

collapse all

This example shows how to compute the cost of implementing an FIR Filter created using dsp.FIRFilter object.

Fs = 8000; Fcutoff = 2000;
FIRFilt = dsp.FIRFilter('Numerator', fir1(130,Fcutoff/(Fs/2)));
cost(FIRFilt)
ans = 

  struct with fields:

                  NumCoefficients: 131
                        NumStates: 130
    MultiplicationsPerInputSample: 131
          AdditionsPerInputSample: 130

See Also

Introduced in R2011a

Was this topic helpful?