Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

single

Cast coefficients of digital filter to single precision

Syntax

f2 = single(f1)

Description

example

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.

Examples

collapse all

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 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 = 
'double'
classe = class(e.Coefficients)
classe = 
'single'

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.

Introduced in R2014a

Was this topic helpful?