# Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# LeastSquaresFilterKernel

LeastSquaresFilterKernel[{{ω1,,ωk-1},{a1,,ak}},n]
creates a k-band finite impulse response (FIR) filter kernel of length n designed using a least squares method, given the specified frequencies ωi and amplitudes ai.

LeastSquaresFilterKernel[{"type",spec},n]
uses the full filter specification {"type",spec}.

## Details and OptionsDetails and Options

• LeastSquaresFilterKernel returns a numeric list of length n of the impulse response coefficients of an FIR filter that has the minimum mean-squared error.
• The impulse response of the filter is computed using the inverse discrete-time Fourier transform.
• In LeastSquaresFilterKernel[{"type",spec},n], filter specification can be any of the following:
•  {"Lowpass",ωc} lowpass filter with cutoff frequency ωc {"Highpass",ωc} highpass filter with cutoff frequency ωc {"Bandpass",{ωc1,ωc2}} bandpass filter with pass band from ωc1 to ωc2 {"Bandpass",{{ω,q}}} bandpass filter with center frequency ω and quality factor q {"Bandstop",{ωc1,ωc2}} bandstop filter with stop band from ωc1 to ωc2 {"Bandstop",{{ω,q}}} bandstop filter with center frequency ω and quality factor q {"Multiband",{ω1,…,ωk-1},{a1,…,ak}} multiband filter specification with k bands {"Differentiator",ωc} differentiator filter with cutoff frequency ωc {"Hilbert",ωc} Hilbert filter with cutoff frequency ωc
• If "type" is omitted, "Multiband" is assumed.
• Frequencies should be given in an ascending order such that 0<ω1<ω2<<ωk-1<π.
• Amplitude value a1 corresponds to the frequency band 0 to ω1, and amplitude ak corresponds to the frequency band ωk-1 to π.
• Amplitude values should be non-negative. Typically, values ai=0 specify a stopband, and values ai=1 specify a passband.
• The quality factor q is defined as , with being the center frequency of a bandpass or bandstop filter. Higher values of q give narrower filters.
• The kernel ker, returned by LeastSquaresFilterKernel, can be used in ListConvolve[ker,data] to apply the filter to data.
• LeastSquaresFilterKernel takes a WorkingPrecision option, which specifies the precision to use in internal computations. The default setting is .

## ExamplesExamplesopen allclose all

### Basic Examples  (2)Basic Examples  (2)

A lowpass FIR kernel:

 In[1]:=
 Out[1]=

Magnitude plot of the filter and its ideal lowpass prototype:

 In[2]:=
 Out[2]=

A Bode plot of the filter:

 In[3]:=
 Out[3]=

A multiband FIR kernel:

 In[1]:=
 Out[1]=

Magnitude plot of the filter and its "brickwall" specification:

 In[2]:=
 Out[2]=