Supported Functions

Code generation from MATLAB® is a restricted subset of the MATLAB language that provides optimizations for:

  • Generating efficient, production-quality C/C++ code and MEX files for deployment in desktop and embedded applications. For embedded targets, the subset restricts MATLAB semantics to meet the memory and data type requirements of the target environments.

Depending on which feature you wish to use, there are additional required products. For a comprehensive list, see Installing Prerequisite Products (MATLAB Coder).

Code generation from MATLAB supports Signal Processing Toolbox™ functions listed in the table. To generate C code, you must have the MATLAB Coder™ software. If you have the Fixed-Point Designer™ software, you can use fiaccel to generate MEX code for fixed-point applications.

To follow the examples in this documentation:

  • To generate C/C++ code and MEX files with codegen, install the MATLAB Coder software, the Signal Processing Toolbox, and a C compiler. For the Windows® platform, MATLAB supplies a default C compiler. Run mex -setup at the MATLAB command prompt to set up the C compiler.

  • Change to a folder where you have write permission.

An asterisk (*) indicates that the reference page has usage notes and limitations for C/C++ code generation.

abs

Absolute value and complex magnitude

alignsignals

Align two signals by delaying earliest signal

angle

Phase angle

barthannwin

Modified Bartlett-Hann window

bartlett

Bartlett window

besselap*

Bessel analog lowpass filter prototype

bitrevorder

Permute data into bit-reversed order

blackman

Blackman window

blackmanharris

Minimum four-term Blackman-Harris window

bohmanwin

Bohman window

buttap

Butterworth filter prototype

butter*

Butterworth filter design

buttord*

Butterworth filter order and cutoff frequency

cconv

Modulo-n circular convolution

cfirpm*

Complex and nonlinear-phase equiripple FIR filter design

cheb1ap*

Chebyshev Type I analog lowpass filter prototype

cheb1ord*

Chebyshev Type I filter order

cheb2ap*

Chebyshev Type II analog lowpass filter prototype

cheb2ord*

Chebyshev Type II filter order

chebwin

Chebyshev window

cheby1*

Chebyshev Type I filter design

cheby2*

Chebyshev Type II filter design

chirp

Swept-frequency cosine

conv*

Convolution and polynomial multiplication

conv2

2-D convolution

convmtx

Convolution matrix

corrcoef*

Correlation coefficients

corrmtx

Data matrix for autocorrelation matrix estimation

cov*

Covariance

cpsd

Cross power spectral density

cummax

Cumulative maximum

cummin

Cumulative minimum

czt*

Chirp Z-transform

db2pow

Convert decibels to power

dct*

Discrete cosine transform

deconv*

Deconvolution and polynomial division

detrend*

Remove polynomial trend

dftmtx

Discrete Fourier transform matrix

diric

Dirichlet or periodic sinc function

downsample

Decrease sample rate by integer factor

dpss*

Discrete prolate spheroidal (Slepian) sequences

ellip*

Elliptic filter design

ellipap*

Elliptic analog lowpass filter prototype

ellipord*

Minimum order for elliptic filters

emd

Empirical mode decomposition

envelope*

Signal envelope

envspectrum

Envelope spectrum for machinery diagnosis

eqtflength

Equalize lengths of transfer function's numerator and denominator

fft*

Fast Fourier transform

fft2*

2-D fast Fourier transform

fftfilt*

FFT-based FIR filtering using overlap-add method

fftshift

Shift zero-frequency component to center of spectrum

fillmissing*

Fill missing values

filloutliers*

Detect and replace outliers in data

filter*

1-D digital filter

filter2

2-D digital filter

filtfilt*

Zero-phase digital filtering

filtord

Filter order

finddelay

Estimate delay(s) between signals

findpeaks

Find local maxima

fir1

Window-based FIR filter design

fir2*

Frequency sampling-based FIR filter design

fircls*

Constrained-least-squares FIR multiband filter design

fircls1*

Constrained-least-squares linear-phase FIR lowpass and highpass filter design

firls

Least-squares linear-phase FIR filter design

firpm*

Parks-McClellan optimal FIR filter design

firpmord*

Parks-McClellan optimal FIR filter order estimation

flattopwin

Flat top weighted window

freqspace

Frequency spacing for frequency response

freqz*

Frequency response of digital filter

fsst*

Fourier synchrosqueezed transform

gauspuls

Gaussian-modulated sinusoidal RF pulse

gausswin

Gaussian window

gmonopuls

Gaussian monopulse

goertzel*

Discrete Fourier transform with second-order Goertzel algorithm

hamming

Hamming window

hann

Hann (Hanning) window

hilbert

Discrete-time analytic signal using Hilbert transform

idct*

Inverse discrete cosine transform

ifft*

Inverse fast Fourier transform

ifft2*

2-D inverse fast Fourier transform

ifsst

Inverse Fourier synchrosqueezed transform

interp1*

1-D data interpolation (table lookup)

intfilt*

Interpolation FIR filter design

iscola

Determine whether window-overlap combination is COLA compliant

isoutlier*

Find outliers in data

istft*

Inverse short-time Fourier transform

kaiser

Kaiser window

kaiserord

Kaiser window FIR filter design estimation parameters

levinson*

Levinson-Durbin recursion

lsf2poly

Convert line spectral frequencies to prediction filter coefficients

max*

Maximum elements of an array

maxflat*

Generalized digital Butterworth filter design

mean*

Average or mean value of array

median*

Median value of array

min*

Minimum elements of an array

movmad*

Moving median absolute deviation

movmedian*

Moving median

mscohere

Magnitude-squared coherence

nuttallwin

Nuttall-defined minimum 4-term Blackman-Harris window

parzenwin

Parzen (de la Vallée Poussin) window

pchip*

Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)

peak2peak

Maximum-to-minimum difference

peak2rms

Peak-magnitude-to-RMS ratio

periodogram

Periodogram power spectral density estimate

plomb

Lomb-Scargle periodogram

poly2ac*

Convert prediction filter polynomial to autocorrelation sequence

poly2lsf*

Convert prediction filter coefficients to line spectral frequencies

poly2rc*

Convert prediction filter polynomial to reflection coefficients

pow2db

Convert power to decibels

pulstran*

Pulse train

pwelch

Welch's power spectral density estimate

rainflow

Rainflow counts for fatigue analysis

randn*

Normally distributed random numbers

rc2ac*

Convert reflection coefficients to autocorrelation sequence

rc2poly*

Convert reflection coefficients to prediction filter polynomial

rceps

Real cepstrum and minimum phase reconstruction

rcosdesign*

Raised cosine FIR pulse-shaping filter design

rectpuls

Sampled aperiodic rectangle

rectwin

Rectangular window

resample*

Resample uniform or nonuniform data to new fixed rate

rlevinson*

Reverse Levinson-Durbin recursion

rms

Root-mean-square level

sawtooth

Sawtooth or triangle wave

sgolay

Savitzky-Golay filter design

sgolayfilt

Savitzky-Golay filtering

sin

Sine of argument in radians

sinc

Sinc function

sos2tf

Convert digital filter second-order section data to transfer function form

sosfilt

Second-order (biquadratic) IIR digital filtering

spline*

Cubic spline data interpolation

square

Square wave

std*

Standard deviation

stft

Short-time Fourier transform

taylorwin

Taylor window

tf2ss

Convert transfer function filter parameters to state-space form

tfridge*

Time-frequency ridges

triang

Triangular window

tripuls

Sampled aperiodic triangle

tsa

Time-synchronous signal average

tukeywin

Tukey (tapered cosine) window

unwrap*

Shift phase angles

upfirdn*

Upsample, apply FIR filter, and downsample

upsample

Increase sample rate by integer factor

var*

Variance

wvd*

Wigner-Ville distribution and smoothed pseudo Wigner-Ville distribution

xcorr*

Cross-correlation

xcorr2

2-D cross-correlation

xcov

Cross-covariance

xwvd*

Cross Wigner-Ville distribution and cross smoothed pseudo Wigner-Ville distribution

yulewalk*

Recursive digital filter design

zp2tf

Convert zero-pole-gain filter parameters to transfer function form