Documentation

cost

Estimate cost of discrete-time or multirate filter

Syntax

c = cost(hd)
c = cost(hm)
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(hm) return a cost estimate c for the multirate filter hm.

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.

hm

Multirate mfilt 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, say dsp.FIRHalfbandDecimator, execute dsp.FIRHalfbandDecimator.helpFilterAnalysis in 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.

'Arithmetic' — Value types:‘double' | 'single' | 'fixed'

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

These examples show you the cost method applied to dfilt and mfilt objects.

hd = design(fdesign.lowpass);
c = cost(hd);

When you are using a multirate filter object, cost works the same way.

d = fdesign.decimator(4,'cic');
hm = design(d,'multisection');

See Also

Was this topic helpful?