Main Content

cost

Estimate implementation cost of audio System objects

Description

example

implementationCost = cost(audioObj) returns a structure, implementationCost, whose fields contain information about the computation cost of implementing the audio System object™, audioObj.

Examples

collapse all

Create a crossover filter with 2 crossovers with 48 dB/octave slopes. Call cost to get an estimate of the implementation cost.

crossFilt = crossoverFilter('NumCrossovers',2,'CrossoverSlopes',48);
cost1 = cost(crossFilt)
cost1 = struct with fields:
                  NumCoefficients: 120
                        NumStates: 48
    MultiplicationsPerInputSample: 120
          AdditionsPerInputSample: 97

Reduce the crossover slopes for both crossovers to 12 dB/octave. Call cost to get an estimate of the new implementation cost.

crossFilt.CrossoverSlopes = 12;
cost2 = cost(crossFilt)
cost2 = struct with fields:
                  NumCoefficients: 36
                        NumStates: 12
    MultiplicationsPerInputSample: 36
          AdditionsPerInputSample: 25

Input Arguments

collapse all

Specify the input as a supported audio System object.

Data Types: object

Output Arguments

collapse all

Estimate of the implementation cost of a filter, returned as struct:

Structure Field

Description

NumCoefficients

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

NumStates

Number of states

MultiplicationsPerInputSample

Number of multiplication per input sample

AdditionsPerInputSample

Number of additions per input sample

Version History

Introduced in R2016a