This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

cost

Estimate cost for implementing filter System objects

Syntax

c = cost(sysobj)
c = cost(sysobj,'Arithmetic',arithType)

Description

example

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

c = cost(sysobj,'Arithmetic',arithType) returns a cost estimate c for the filter System object sysobj in the arithmetic specified by arithType.

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

Input Arguments

collapse all

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

System Object StateCoefficient Data TypeRule
Unlocked'Same as input'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

collapse all

Cost estimate, c contains the following fields:

Estimated Value

Description

NumCoefficients

Number of filter coefficients (excluding coefficients with values 0, 1 or -1)

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

Introduced in R2011a