You are here : matlabSignal Processingfilt2block

filt2block() - Signal Processing

examplefilt2block(b) generates
a Discrete FIR Filter block  with filter coefficients, b.
filt2block(b,'subsystem') generates
a Simulink® subsystem block that implements an FIR filter using
sum, gain, and delay blocks.
examplefilt2block(___,'FilterStructure',structure) specifies
the filter structure for the FIR filter.

examplefilt2block(b,a) generates
a Discrete Filter block with numerator coefficients, b,
and denominator coefficients, a.
 filt2block(b,a,'subsystem') generates
a Simulink subsystem block that implements an IIR filter using
sum, gain, and delay blocks.
examplefilt2block(___,'FilterStructure',structure) specifies
the filter structure for the IIR filter.

filt2block(sos) generates
a Biquad Filter block with second order sections
matrix, sos. sos is a K-by-6
matrix, where the number of sections, K, must be
greater than or equal to 2. You must have the DSP System Toolbox™ software
installed to use this syntax.
example filt2block(sos,'subsystem') generates
a Simulink subsystem block that  implements a biquad filter using
sum, gain, and delay blocks.
filt2block(___,'FilterStructure',structure) specifies
the filter structure for the biquad filter.

filt2block(d) generates
a Simulink block that implements a digital filter, d.
Use the function designfilt to
create d. The block is a Discrete FIR
Filter block if d is FIR and a Biquad
Filter block if d is IIR.
 filt2block(d,'subsystem') generates
a Simulink subsystem block that implements d using
sum, gain, and delay blocks.
examplefilt2block(___,'FilterStructure',structure) specifies
the filter structure to implement d.

examplefilt2block(___,Name,Value) uses
additional options specified by one or more Name,Value pair
arguments.


Syntax

filt2block(b) examplefilt2block(b,'subsystem')filt2block(___,'FilterStructure',structure) examplefilt2block(b,a) example filt2block(b,a,'subsystem')filt2block(___,'FilterStructure',structure) examplefilt2block(sos) filt2block(sos,'subsystem') examplefilt2block(___,'FilterStructure',structure)filt2block(d) filt2block(d,'subsystem')filt2block(___,'FilterStructure',structure) examplefilt2block(___,Name,Value) example


Example

Generate Block from FIR Filter
Design an order 30 FIR filter using the window
method. Specify a cutoff frequency of π/4 radians/sample. Create
a Simulink block.
b = fir1(30,0.25);
filt2block(b)Generate Block from IIR Filter
Design an order 30 IIR Butterworth filter.
Specify a cutoff frequency of π/4 radians/sample. Create a Simulink block.
[b,a] = butter(30,0.25);
filt2block(b,a)Generate FIR Filter with Direct Form I Transposed Structure
Design an order 30 FIR filter using the window
method. Specify a cutoff frequency of π/4 radians/sample. Create
a Simulink block with a direct form I transposed structure
b = fir1(30,0.25);
filt2block(b,'FilterStructure','directFormTransposed')Generate IIR Filter with Direct Form I Structure
Design an order 30 IIR Butterworth filter.
Specify a cutoff frequency of π/4 radians/sample. Create a Simulink block
with a direct form I structure.
[b,a] = butter(30,0.25);
filt2block(b,a,'FilterStructure','directForm1')Generate Simulink Subsystem Block from Second Order Section Matrix
Design a 5-th order Butterworth filter with
a cutoff frequency of 0.2π radians/sample. Obtain the filter
in biquad form and generate a Simulink subsystem block from the
second order sections.
[z,p,k] = butter(5,0.2); 
sos = zp2sos(z,p,k);
filt2block(sos,'subsystem') Lowpass FIR Filter Block with Sample-Based Processing
 Generate a Simulink subsystem block that implements
an FIR lowpass filter using sum, gain, and delay blocks. Specify the
input processing to be elements as channels by specifying 'FrameBasedProcessing' as false. 
B = fir1(30,.25);
filt2block(B,'subsystem','BlockName','Lowpass FIR',...
              'FrameBasedProcessing',false)New Model with Highpass Elliptic Filter BlockDesign a highpass elliptic filter with normalized stopband
frequency 0.45 and normalized passband frequency 0.55. Specify a stopband
attenuation of 40 dB and a passband ripple of 0.5 dB. Implement the filter as a Direct Form II
structure, call it "HP", and place it in a new Simulink model.d = designfilt('highpassiir','DesignMethod','ellip', ...
               'StopbandFrequency',0.45,'PassbandFrequency',0.55, ...
               'StopbandAttenuation',40,'PassbandRipple',0.5);
          
filt2block(d,'subsystem','FilterStructure','directForm2', ...
             'Destination','new','BlockName','HP')


Output / Return Value


Limitations


Alternatives / See Also


Reference