Main Content

cost

Implementation cost of the sample rate converter

Description

c = cost(src) returns a structure, c, whose fields contain information about the computational cost of implementing a multistage sample rate converter, src.

example

Examples

collapse all

Create src, a multistage sample rate converter with default values. src combines three filter stages to convert from 192 kHz to 44.1 kHz. Determine its computational cost: the number of coefficients, the number of states, the number of multiplications per unit sample, and the number of additions per unit sample.

src = dsp.SampleRateConverter;
cst = cost(src)
cst = struct with fields:
                  NumCoefficients: 8631
                        NumStates: 138
    MultiplicationsPerInputSample: 27.6672
          AdditionsPerInputSample: 26.6875

Repeat the computation allowing a tolerance of 10% in the output sample rate.

src.OutputRateTolerance = 0.1;
ctl = cost(src)
ctl = struct with fields:
                  NumCoefficients: 44
                        NumStates: 80
    MultiplicationsPerInputSample: 14.2500
          AdditionsPerInputSample: 13.5000

Input Arguments

collapse all

Multistage sample rate converter, specified as a dsp.SampleRateConverter System object.

Output Arguments

collapse all

Output structure with information about the computational cost of src:

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

Version History

Introduced in R2014b

Go to top of page