Shelving Filter
Libraries:
Audio Toolbox /
Filters
Description
The Shelving Filter block applies a shelving filter to the input signal. A shelving filter boosts or cuts the frequency spectrum of the input signal above or below a given cutoff frequency.
Examples
Filter Audio Using Shelving Filter Block
Use the Shelving Filter block to filter an audio signal in Simulink.
Ports
Input
x — Input signal
column vector | matrix
Input signal to be filtered, specified as a column vector or a matrix. If the input is a matrix, each column is treated as an independent channel.
Data Types: single
| double
G — Peak gain (dB)
real scalar
This port specifies the value of the Gain (dB) parameter.
Dependencies
To enable this port, select the Specify gain from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
S — Slope
positive scalar
This port specifies the value of the Slope parameter.
Dependencies
To enable this port, select the Specify slope from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
F — Cutoff frequency
nonnegative scalar
This port specifies the value of the Cutoff frequency (Hz) parameter.
Dependencies
To enable this port, select the Specify cutoff frequency from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output
Port_1 — Output signal
column vector | matrix
Filtered output signal, returned as a column vector or matrix that is the same size and data type as the input signal.
Data Types: single
| double
Parameters
Specify gain from input port — Use additional input port to specify gain
off
(default) | on
When you select this parameter, an additional input port, G, is added to the block. This port specifies the gain of the filter.
Gain (dB) — Peak gain (dB)
0
(default) | real scalar
Peak gain of the filter in dB, specified as a real scalar. The gain specifies how much the filter will boost (if the gain is positive) or cut (if the gain is negative) the frequency spectrum of the input signal.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify gain from input port parameter.
Specify slope from input port — Use additional input port to specify slope
off
(default) | on
When you select this parameter, an additional input port, S, is added to the block. This port specifies the slope of the filter.
Slope — Filter slope
1.5
(default) | positive scalar
Slope of the filter specified as a positive scalar. The slope controls the width of the transition band in the filter response.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify slope from input port parameter.
Specify cutoff frequency from input port — Use additional input port to specify cutoff frequency
off
(default) | on
When you select this parameter, an additional input port, F, is added to the block. This port specifies the cutoff frequency of the filter.
Cutoff frequency (Hz) — Filter cutoff frequency
200
(default) | nonnegative scalar
Cutoff frequency of the filter in Hz, specified as a nonnegative scalar in the range
[0,Fs
/2], where Fs
is the sample rate specified
by the Input sample rate (Hz) and Inherit sample rate
from input parameters. The cutoff frequency specifies the frequency at half
of the peak gain of the filter, G
/2 dB, where G
is
the peak gain.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify cutoff frequency from input port parameter.
Type — Type of filter
lowpass
(default) | highpass
Type of shelving filter, specified as lowpass
or
highpass
.
lowpass
–– Boost or cut the frequency spectrum below the cutoff frequency.highpass
–– Boost or cut the frequency spectrum above the cutoff frequency.
Inherit sample rate from input — Specify source of input sample rate
off
(default) | on
When you select this parameter, the block inherits its sample rate from the input signal. When you clear this parameter, you specify the sample rate in Input sample rate (Hz).
Input sample rate (Hz) — Sample rate of input
44100
(default) | positive scalar
Sample rate of the input, specified as a positive scalar.
Dependencies
To enable this parameter, clear the Inherit sample rate from input parameter.
Visualize filter response — Open plot to visualize filter response
button
Open plot to visualize the magnitude response of the filter.
Variable name — Variable name of exported filter
myFilt
(default) | valid variable name
Name of the variable in the base workspace to contain the filter when it is exported. The name must be a valid MATLAB® variable name.
Overwrite variable if it already exists — Overwrite variable if it already exists
on
(default) | off
When you select this parameter, exporting the filter overwrites the variable
specified by the Variable name parameter if it already exists in
the base workspace. If you do not select this parameter and the specified variable
already exists in the workspace, exporting the filter creates a new variable with an
underscore and a number appended to the variable name. For example, if the variable name
is var
and it already exists, the exported variable will be named
var_1
.
Export filter to workspace — Export filter to workspace
button
Export the filter to the base workspace in the variable specified by the Variable name parameter.
Tips
You cannot export the filter if you have enabled the Inherit sample rate from input parameter and the model is not running.
You cannot export the filter if you are specifying filter characteristics from input ports.
Simulate using — Specify type of simulation to run
Interpreted execution
(default) | Code generation
Interpreted execution
–– Simulate model using the MATLAB interpreter. This option shortens startup time but has a slower simulation speed thanCode generation
. In this mode, you can debug the source code of the block.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 the speed of the subsequent simulations is comparable toInterpreted execution
.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2022a
See Also
Blocks
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)