Package: dsp
IIR filter using biquadratic structures
The BiquadFilter
object implements an IIR
filter structure using biquadratic or second–order sections
(SOS).
To implement an IIR filter structure using biquadratic or SOS:
Define and set up your biquadratic IIR filter. See Construction.
Call step
to implement the IIR filter
according to the properties of dsp.BiquadFilter
.
The behavior of step
is specific to each object in
the toolbox.
H = dsp.BiquadFilter
returns
a default biquadratic IIR filter, H
, which independently
filters each channel of the input over successive calls to the step
method
using the SOS section[1 0.3 0.4 1 0.1 0.2]
with
a directform II transposed structure.
H = dsp.BiquadFilter('
returns a biquadratic filter object, PropertyName
',PropertyValue
,
...)H
,
with each property set to the specified value.

Filter structure Specify the filter structure as one of  

SOS matrix source Specify the source of the SOS matrix as one of  

SOS matrix Specify the secondorder section (SOS) matrix as an Nby6 matrix,
where N is the number of sections in the filter. The default is $$H(z)=\frac{{\displaystyle \sum _{k=0}^{2}{b}_{k}}{z}^{k}}{1{\displaystyle \sum _{l=1}^{2}{a}_{l}}{z}^{l}}$$ The coefficients are
ordered in the rows of the SOS matrix as (b_{0},
b_{1,}b_{2,}1, –a_{1},
–a_{2}). You can use
coefficients of real or complex values. This property applies only
when you set the 

Scale values for each biquad section Specify the scale values to apply before and after each section
of a biquad filter. This property applies only when you set the 

Initial conditions for direct form II structures Specify the initial conditions of the filter states when the When you specify a scalar value, the biquad filter initializes all delay elements in the filter to that value. When you specify a vector of length equal to the number of delay elements in the filter, each vector element specifies a unique initial condition for the corresponding delay element. The biquad filter applies the same vector of initial conditions
to each channel of the input signal. When you specify a vector of
length equal to the product of the number of input channels and the
number of delay elements in the filter, each element specifies a unique
initial condition for the corresponding delay element in the corresponding
channel. When you specify a matrix with the same number of rows as
the number of delay elements in the filter, and one column for each
channel of the input signal, each element specifies a unique initial
condition for the corresponding delay element in the corresponding
channel. The default is the scalar 

Initial conditions on zeros side Specify the initial conditions of the filter states on the side
of the filter structure with the zeros. This property applies only
when you set the The biquad filter applies the same vector of initial conditions
to each channel of the input signal. When you specify a vector of
length equal to the product of the number of input channels and the
number of delay elements on the zeros side in the filter, each element
specifies a unique initial condition for the corresponding delay element
on the zeros side in the corresponding channel. When you specify a
matrix with the same number of rows as the number of delay elements
on the zeros side in the filter, and one column for each channel of
the input signal, each element specifies a unique initial condition
for the corresponding delay element on the zeros side in the corresponding
channel. The default is the scalar 

Initial conditions on poles side Specify the initial conditions of the filter states on the side
of the filter structure with the poles. This property only applies
when you set the The object applies the same vector of initial conditions to
each channel of the input signal. When you specify a vector of length
equal to the product of the number of input channels and the number
of delay elements on the poles side in the filter, each element specifies
a unique initial condition for the corresponding delay element on
the poles side in the corresponding channel. When you specify a matrix
with the same number of rows as the number of delay elements on the
poles side in the filter, and one column for each channel of the input
signal, each element specifies a unique initial condition for the
corresponding delay element on the poles side in the corresponding
channel. The default is the scalar 

Optimize unity scale values When this Boolean property is set to 

How to specify scale values Select how to specify scale values. This property applies only
when the 
clone  Create biquad filter object with same property values 
freqz  Frequency response 
fvtool  Open filter visualization tool 
getNumInputs  Number of expected inputs to step method 
getNumOutputs  Number of outputs of step method 
impz  Impulse response 
isLocked  Locked status for input attributes and nontunable properties 
phasez  Unwrapped phase response 
release  Allow property value and input characteristics changes 
reset  Reset states of biquad filter object 
step  Filter input with biquad filter object 
Use a fourth order, lowpass biquadratic filter object with a normalized cutoff frequency of 0.4 to filter high frequencies from an input signal. Display the result as a power spectrum using the Spectrum Analyzer:
t = (0:1000)'/8e3; xin = sin(2*pi*0.3e3*t)+sin(2*pi*3e3*t); % Input is 0.3 & % 3kHz sinusoids hFromWS = dsp.SignalSource(xin, 100); hLog = dsp.SignalSink; [z,p,k] = ellip(4,1,60,.4); % Set up the filter [s,g] = zp2sos(z,p,k); hBqF=dsp.BiquadFilter('Structure','Direct form I', ... 'SOSMatrix',s,'ScaleValues',g); h = dsp.SpectrumAnalyzer('SampleRate',8e3,... 'PlotAsTwoSidedSpectrum',false,... 'OverlapPercent', 80,'PowerUnits','dBW',... 'YLimits', [160 10]); while ~isDone(hFromWS) input = step(hFromWS); filteredOutput = step(hBqF,input); step(hLog,filteredOutput); step(h,filteredOutput) end filteredResult = hLog.Buffer; fvtool(hBqF,'Fs',8000)
Design and apply a lowpass biquad filter System object™ using design
.
Hd = fdesign.lowpass('Fp,Fst,Ap,Ast',500,550,0.5,60,10000); D = design(Hd,'butter','systemobject',true) fvtool(D);
D = System: dsp.BiquadFilter Properties: Structure: 'Direct form II' SOSMatrixSource: 'Property' SOSMatrix: [42x6 double] ScaleValues: [43x1 double] InitialConditions: 0 OptimizeUnityScaleValues: true
This object implements the algorithm, inputs, and outputs described on the Biquad Filter block reference page. The object properties correspond to the block parameters, except:
Coefficient source – the
biquad filter object does not accept dfilt
objects
as an SOSMatrixSource
.
Action when the a0 values of the SOS matrix
are not one – the biquad filter object assumes the
zerothorder denominator coefficient equals 1 regardless of the specified
value. The biquad filter object does not support the Error
or Warn
options
found in the corresponding block.
Both this object and its corresponding block support variablesize input. This means that the step method can handle an input which is changing in size.