cost - Cost of using discrete-time or multirate filter

Syntax

c = cost(hd)
c = cost(hm)

Description

c = cost(hd) and c = cost(hm) return a cost estimate c for the filter hd or hm. The returned cost estimate contains the following fields.

Estimated Value

Property

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.

MultPerInputSample

multperinputsample

Number of multiplication operations performed for each input sample

AddPerInputSample

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)
c =
 
Number of Multipliers : 43
Number of Adders      : 42
Number of States      : 42
MultPerInputSample    : 43
AddPerInputSample     : 42
hd
 
hd =
 
     FilterStructure: 'Direct-Form FIR'
          Arithmetic: 'double'         
           Numerator: [1x43 double]    
    PersistentMemory: false

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

d = fdesign.decimator(4,'cic');
hm = design(d,'multisection')
 
hm =
 
  FilterStructure: 'Cascaded Integrator-Comb Decimator'
       Arithmetic: 'fixed'
DifferentialDelay: 1
 NumberOfSections: 2
 DecimationFactor: 4
 PersistentMemory: false
 
 InputWordLength: 16             
 InputFracLength: 15             
 
 FilterInternals: 'FullPrecision'

c=cost(hm)
 
c =
 
Number of Multipliers : 0  
Number of Adders      : 4  
Number of States      : 4  
MultPerInputSample    : 0  
AddPerInputSample     : 2.5

See Also

qreport

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS