Main Content


Cast coefficients of digital filter to single precision



f2 = single(f1) casts coefficients in a digital filter, f1, to single precision and returns a new digital filter, f2, that contains these coefficients. This is the only way that you can create single-precision digitalFilter objects.


collapse all

Use designfilt to design a 5th-order FIR lowpass filter. Specify a normalized passband frequency of 0.2π rad/sample and a normalized stopband frequency of 0.55π rad/sample. Cast the filter coefficients to single precision.

format long
d = designfilt('lowpassfir','FilterOrder',5, ...
               'PassbandFrequency',0.2,'StopbandFrequency', 0.55);
e = single(d);
classd = class(d.Coefficients)
classd = 
classe = class(e.Coefficients)
classe = 

Input Arguments

collapse all

Digital filter, specified as a digitalFilter object. Use designfilt to generate f1 based on frequency-response specifications.

Example: d = designfilt('lowpassiir','FilterOrder',3,'HalfPowerFrequency',0.5) specifies a third-order Butterworth filter with normalized 3-dB frequency 0.5π rad/sample.

Output Arguments

collapse all

Single-precision digital filter, returned as a digitalFilter object.

Version History

Introduced in R2014a