Main Content

Shelving Filter

Second-order IIR shelving filter

  • Library:
  • Audio Toolbox / Filters

  • Shelving Filter block

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.

Ports

Input

expand all

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

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

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

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

expand all

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

expand all

When you select this parameter, an additional input port, G, is added to the block. This port specifies the gain of the filter.

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.

When you select this parameter, an additional input port, S, is added to the block. This port specifies the slope of the filter.

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.

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 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 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.

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).

Sample rate of the input, specified as a positive scalar.

Dependencies

To enable this parameter, clear the Inherit sample rate from input parameter.

Open plot to visualize the magnitude response of the filter.

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.

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 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.

  • Interpreted execution –– Simulate model using the MATLAB interpreter. This option shortens startup time but has a slower simulation speed than Code 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 to Interpreted execution.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

yes

Zero-Crossing Detection

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2022a