Documentation

# cost

Estimate cost for implementing filter System objects

## Syntax

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

## Description

example

````c = cost(sysobj)` returns a structure, `c`, whose fields contain information about the computational cost of implementing 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 the arithmetic input is not specified and the filter System object is unlocked, the analysis tool assumes a double-precision filter. The `'Arithmetic'` property set to `'Fixed'` applies only to filter System objects with fixed-point properties.

## 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