Design Filter
Design a digital filter in the Live Editor
Description
Design Filter helps you design a digital filter
interactively. The task automatically generates and runs MATLAB® code to design a filter using the digitalFilter
object.
To get started, select a filter response type. The task offers controls to specify filter parameters that depend on the type of filter response and include:
Filter order
Frequency constraints
Magnitude constraints
Design method
Choose from a list of display options to visualize the generated filter
response and additional filter information. For a detailed description of the filter
constraints, design methods, and design method parameters, see the designfilt
documentation.
For more information about Live Editor tasks, see Add Interactive Tasks to a Live Script.
Open the Task
To add the Design Filter task to a live script in the MATLAB Editor:
On the Live Editor tab, select Design Filter.
In a code block in the script, type a relevant keyword, such as
designfilt
,filter
, orlowpass
. SelectDesign Filter
from the suggested command completions.
Examples
Parameters
Filter response
— Filter response type
Lowpass FIR
| Highpass FIR
| Bandpass FIR
| Bandstop FIR
| Hilbert Transformer FIR
| Differentiator FIR
| Lowpass IIR
| Highpass IIR
| Bandpass IIR
| Bandstop IIR
Choose the filter response type as one of these:
Lowpass FIR
Lowpass IIR
Highpass FIR
Highpass IIR
Bandpass FIR
Bandpass IIR
Bandstop FIR
Bandstop IIR
Hilbert Transformer FIR
Differentiator FIR
Filter Order
— Filter order
Minimum
| Specify
Design a minimum order filter or specify a filter order. Some responses might not have a minimum order design available and will require you to specify a filter order value.
Frequency constraints
— Frequencies at which filter exhibits desired behavior
Passband and stopband frequencies
| Cutoff (6dB) frequency
| Half power (3dB) frequency
| ...
Specify the frequencies at which the designed filter exhibits a desired behavior. Available options depend on filter response type and filter order.
Note
You can specify Frequency units as Normalized (0
to 1)
(default) or Hz
. If you specify frequency units
in hertz, you must specify a sample rate.
Magnitude constraints
— Filter magnitude response behavior at particular frequency ranges
Passband ripple
| Stopband attenuation
| ...
Choose the filter magnitude response behavior at the specified frequency ranges. Available options depend on filter response type, filter order, and frequency constraints.
Design method
— Filter design algorithm
Butterworth
| Equiripple
| FIR least-squares
| ...
Specify the algorithm used to design the filter. Available options depend on filter response type, filter order, and frequency and magnitude constraints. Some design methods have additional options available in the Design options section.
Note
In some design cases, there are model order restrictions. If an even or odd restriction exists for the selected design method and the specified order is not valid, the task reduces the order by one.
Tips
You can toggle the autorun option by clicking the circle in the top right corner of the task window. If autorun is enabled, the current section including the task runs automatically when a change is made.
References
[1] Moody, G.B., and R.G. Mark. "The Impact of the MIT-BIH Arrhythmia Database". IEEE Eng in Med and Biol 20(3):45-50 (May-June 2001): 45-50.
Version History
Introduced in R2021b