design fir or iir lowpass filter -凯发k8网页登录
design fir or iir lowpass filter
libraries:
dsp system toolbox /
filtering /
filter designs
description
the lowpass filter block independently filters each channel of the input signal over time using the filter design specified by the block parameters. you can control whether the block implements an iir or fir lowpass filter using the filter type parameter. you can specify the passband and stopband edge frequencies in hz or in normalized frequency units (since r2023a).
this block supports arm® cortex® code generation. under certain conditions, this block also supports simd code generation. for details, see code generation.
examples
ports
input
port_1 — input signal to filter
column vector | matrix
input signal, specified as a real- or complex-valued column vector or matrix. if the input signal is a matrix, each column of the matrix is treated as an independent channel. the number of rows in the input signal denotes the channel length.
data types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fixed point
complex number support: yes
output
port_1 — filtered signal
vector | matrix
filtered signal, returned as a vector or matrix. the output has the same size, data type, and complexity characteristics as the input.
data types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fixed point
complex number support: yes
parameters
main
filter type — fir or iir filter
fir
(default) | iir
specify whether the block implements an fir lowpass filter or an iir lowpass filter.
design minimum order filter — design filter with minimum order
on
(default) | off
when you select this check box, the block designs a filter with the minimum order and the specified passband, stopband frequency, passband ripple, and stopband attenuation.
when you clear this check box, you can specify the filter order as a positive integer.
filter order — order of lowpass filter
50
(default) | positive integer
specify the filter order of the lowpass filter as a positive integer.
dependencies
to enable this parameter, clear the design minimum order filter check box.
passband edge frequency (hz) — passband edge frequency
8e3
(default) | real positive scalar
specify the passband edge frequency of the lowpass filter as a real positive scalar in hz or in normalized frequency units (since r2023a).
if you set the sample rate mode parameter to:
specify on dialog
orinherit from input port
–– the value of the passband edge frequency is in hz and must be less than half the value of the input sample rate.use normalized frequency (0 to 1)
–– the value of the passband edge frequency is in normalized frequency units. the value must be a positive scalar less than1.0
.
(since r2023a)
stopband edge frequency (hz) — stopband edge frequency
12e3
(default) | real positive scalar
specify the stopband edge frequency of the lowpass filter as a real positive scalar in hz or in normalized frequency units (since r2023a).
if you set the sample rate mode parameter to:
specify on dialog
orinherit from input port
–– the value of the stopband edge frequency is in hz and must be less than half the value of the input sample rate.use normalized frequency (0 to 1)
–– the value of the stopband edge frequency is in normalized frequency units. the value must be a positive scalar less than1.0
.
(since r2023a)
dependencies
to enable this parameter, select the design minimum order filter check box.
maximum passband ripple (db) — maximum passband ripple
0.1
(default) | real positive scalar
specify the maximum ripple of the filter response in the passband as a real positive scalar in db.
minimum stopband attenuation (db) — minimum stopband attenuation
80
(default) | real positive scalar
specify the minimum attenuation in the stopband as a real positive scalar in db.
sample rate mode — mode to specify the input sample rate
specify on dialog
(default) | inherit from input port
| use normalized frequency (0 to 1)
since r2023a
specify the input sample rate using one of these options:
specify on dialog
–– specify the input sample rate in the block dialog box using the input sample rate (hz) parameter.inherit from input port
–– the block inherits the sample rate from the input signal.use normalized frequency (0 to 1)
–– specify the passband edge and the stopband edge frequencies in normalized frequency units (0 to 1).
input sample rate (hz) — input sample rate
44100
(default) | scalar
specify the input sample rate as a scalar in hz.
dependencies
to enable this parameter, set the
sample rate mode parameter to
specify on dialog
. (since r2023a)
view filter response — open filter visualization tool
button
opens the filter visualization tool () and displays the magnitude and phase response of the lowpass filter. the response is based on the block dialog box parameters. changes made to these parameters update fvtool.
to update the magnitude response while fvtool is running, modify the dialog box parameters and click apply.
simulate using — type of simulation to run
interpreted
execution
(default) | code generation
type of simulation to run:
interpreted execution
(default)simulate model using the matlab® interpreter. this option shortens startup time but has slower simulation speed than
code generation
.code generation
simulate model using generated c code. the first time you run a simulation, simulink® generates c code for the block. the c code is reused for subsequent simulations, as long as the model does not change. this option requires additional startup time but provides faster simulation speed than
interpreted execution
.
data types
rounding mode — rounding method
floor
(default) | ceiling
| convergent
| nearest
| round
| simplest
| zero
rounding method for the output fixed-point operations.
coefficients — coefficient data type
fixdt(1,16)
(default) | fixdt(1,16,0)
|
fixed-point data type of the coefficients, specified as one of the following:
fixdt(1,16)
— signed fixed-point data type of word length16
, with binary point scaling. the block determines the fraction length automatically from the coefficient values in such a way that the coefficients occupy maximum representable range without overflowing.fixdt(1,16,0)
— signed fixed-point data type of word length16
and fraction length0
. you can change the fraction length to any other integer value.— specify the data type using an expression that evaluates to a data type object, for example, numeric type (
fixdt
([ ]
,16
,15
)). specify the sign mode of this data type as[ ]
ortrue
.refresh data type
— refresh to the default data type.
click the show data type assistant button to display the data type assistant, which helps you set the data type. for more information, see (simulink).
block characteristics
data types |
|
direct feedthrough |
|
multidimensional signals |
|
variable-size signals |
|
zero-crossing detection |
|
algorithms
fir lowpass filter
for the minimum order design, the algorithm uses generalized remez fir filter design algorithm. for the specified order design, the algorithm uses the constrained equiripple fir filter design algorithm. the designed filter is then implemented as a linear phase type-1 filter with a direct form
structure.
iir lowpass filter
in the iir configuration, the algorithm uses the elliptic design method to compute the sos and scale values required to meet the filter design specifications. the algorithm uses the sos and scale values to setup a direct form i
biquadratic iir filter, which forms the basis of the iir version of the lowpass filter.
extended capabilities
c/c code generation
generate c and c code using simulink® coder™.
the lowpass filter block supports arm cortex code generation. to learn more about arm cortex code generation, see .
the lowpass filter block also supports simd code generation using intel avx2 technology under these conditions:
filter type is set to
fir
.input signal has a data type of
single
ordouble
.
the simd technology significantly improves the performance of the generated code.
fixed-point conversion
design and simulate fixed-point systems using fixed-point designer™.
version history
introduced in r2015br2023a: support for normalized frequencies
when you set the sample rate mode parameter to
use normalized frequency (0 to 1)
, you can specify
the passband and stopband edge frequencies in normalized frequency units (0 to
1).
matlab 命令
您点击的链接对应于以下 matlab 命令:
请在 matlab 命令行窗口中直接输入以执行命令。web 浏览器不支持 matlab 命令。
select a web site
choose a web site to get translated content where available and see local events and offers. based on your location, we recommend that you select: .
you can also select a web site from the following list:
how to get best site performance
select the china site (in chinese or english) for best site performance. other mathworks country sites are not optimized for visits from your location.
americas
- (español)
- (english)
- (english)
europe
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
asia pacific
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)