You are here : matlabSignal Processingdouble

double() - Signal Processing

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


Syntax

f2 = double(f1) example


Example

Lowpass FIR Filter in Single and Double PrecisionOpen This Example
Use designfilt to design a 5th-order FIR lowpass filter. Specify a normalized passband frequency of 
 rad/sample and a normalized stopband frequency of 
 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)
coee = e.Coefficients(1)
coef = f.Coefficients(1)

coed =

   0.003947882145754


coee =

   0.0039479


coef =

   0.003947881981730

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


Output / Return Value


Limitations


Alternatives / See Also


Reference