## Documentation Center |

The `IIRFilter` object filters each channel
of the input using IIR filter implementations.

To filter each channel of the input:

Define and set up your IIR filter. See Construction.

Call

`step`to filter each channel of the input according to the properties of`dsp.IIRFilter`. The behavior of`step`is specific to each object in the toolbox.

`HIIR = dsp.IIRFilter` returns
an IIR filter System object™, `HIIR`, which independently
filters each channel of the input over successive calls to the `step` method.
This System object uses a specified IIR filter implementation.

`HIIR = dsp.IIRFilter('PropertyName',PropertyValue,
...)` returns an IIR filter System object,

clone | Create IIR filter 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 internal states of IIR filter |

step | Filter input with IIR filter object |

Use fvtool to see the magnitude response of a lowpass IIR filter. Also use the Spectrum Analyzer to display the power spectrum of the output signal.

x = randn(2048,1); x = x-mean(x); Hsr = dsp.SignalSource; Hsr.Signal = x; Hlog = dsp.SignalSink; N = 10; Fc = 0.4; [b,a] = butter(N,Fc); H = dsp.IIRFilter('Numerator',b,'Denominator',a); h = dsp.SpectrumAnalyzer('SampleRate',8e3,... 'PlotAsTwoSidedSpectrum',false,... 'OverlapPercent', 80,'PowerUnits','dBW',... 'YLimits', [-220 -10]); while ~isDone(Hsr) input = step(Hsr); output = step(H,input); step(h,output) step(Hlog,output); end Result = Hlog.Buffer; fvtool(H,'Fs',8000)

Design an IIR filter as a System object.

The are two ways, either you first design the constructor and then design the filter as a System object that you can apply:

D = fdesign.comb('notch','N,BW',8,0.02); H = design(D,'systemobject',true) fvtool(H);

H = System: dsp.IIRFilter Properties: Structure: 'Direct form II' Numerator: [0.887839755524806 0 0 0 0 0 0 0 -0.887839755524806] Denominator: [1 0 0 0 0 0 0 0 -0.775679511049613] InitialConditions: 0 FrameBasedProcessing: true

or, you have the filter coefficients, and then you use dsp.IIRFilter, to apply it:

b = [0.9 zeros(9,1)' -0.9]; a = [1 zeros(9,1)' -0.8]; H = dsp.IIRFilter('Numerator',b,'Denominator',a) fvtool(H);

This object implements the algorithm, inputs, and outputs described on the Discrete Filter block reference page. The object properties correspond to the block parameters.

Both this object and its corresponding block let you specify
whether to process inputs as individual samples or as frames of data.
The object uses the `FrameBasedProcessing` property.
The block uses the **Input processing** parameter.
See Set the FrameBasedProcessing Property of a System object for
more information.

Was this topic helpful?