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

hd

Discrete-time dfilt filter object.

hm

Multirate mfilt filter object.

hs

Filter System object.

The following Filter System objects are supported by this analysis
function:

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'

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.

The function assumes that the coefficient data type is signed,
16 bit, and autoscaled. The function performs fixed-point analysis
based on this assumption.

Unlocked

'Custom'

The function performs fixed-point analysis based on the setting
of the CustomCoefficientsDataType property.

Locked

'Same as input'

When the input data type is 'double' or 'fixed',
the function assumes that the coefficient data type is signed, 16-bit,
and autoscaled. The function performs fixed-point analysis based on
this assumption.

Locked

'Custom'

The function performs fixed-point analysis based on the setting
of the CustomCoefficientsDataType property.

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.

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

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');