# double

Cast coefficients of digital filter to double precision

## Syntax

``f2 = double(f1)``

## Description

example

````f2 = double(f1)` casts coefficients in a digital filter, `f1`, to double precision and returns a new digital filter, `f2`, that contains these coefficients.```

## Examples

collapse all

Use `designfilt` to design a 5th-order FIR lowpass filter. Specify a normalized passband frequency of $0.2\pi$ rad/sample and a normalized stopband frequency of $0.55\pi$ rad/sample.

Cast the filter to single precision and cast it back to double precision. Display the first coefficient of each filter.

```format long d = designfilt('lowpassfir','FilterOrder',5, ... 'PassbandFrequency',0.2,'StopbandFrequency', 0.55); e = single(d); f = double(e); coed = d.Coefficients(1)```
```coed = 0.003947882145754 ```
`coee = e.Coefficients(1)`
```coee = single 0.0039479 ```
`coef = f.Coefficients(1)`
```coef = 0.003947881981730 ```

Use `double` to analyze, in double precision, the effects of single-precision quantization of filter coefficients.

## Input Arguments

collapse all

Single-precision digital filter, specified as a `digitalFilter` object. Use `designfilt` to generate a digital filter based on frequency-response specifications and `single` to cast it to single precision.

Example: `f1= single(designfilt('lowpassfir','FilterOrder',3,'HalfPowerFrequency',0.5))` specifies a third-order Butterworth filter with normalized 3-dB frequency 0.5π rad/sample cast in single precision.

## Output Arguments

collapse all

Double-precision digital filter, returned as a `digitalFilter` object.

## Version History

Introduced in R2014a