Highpass Filter
Design FIR or IIR highpass filter
Libraries:
DSP System Toolbox /
Filtering /
Filter Designs
Description
The Highpass Filter block independently filters each channel of the input signal over time using the given design specifications. You can control whether the block implements an IIR or FIR highpass 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
Highpass Filter Sinusoidal Signal
Highpass filter a sinusoidal signal using the Highpass Filter block. Plot the spectrum of the original signal and the filtered signal in the spectrum analyzer.
Open and inspect the model. The input is a noisy sinusoidal signal with tones at 1 kHz and 15 kHz. The sample rate of the input signal is 44.1 kHz. The added noise is white Gaussian with a mean of 0 and a variance of 0.05.
The highpass filter is a minimumorder filter that has a stopbandedge frequency of 8 kHz and a passbandedge frequency of 12 kHz. Specify the sample rate of the input signal in the block dialog box.
Run the model and view the filtered output in the spectrum analyzer. The tone at 1 kHz is attenuated while the tone at 15 kHz is unaffected.
Highpass Filter Audio Signal
Filter all frequencies below 1.5 kHz from an audio signal whose sample rate is fixed but not known.
Open and inspect the model. The input is a speech signal whose sample rate is unknown. The Highpass Filter block has a passbandedge frequency of 1.5 kHz. The Sample rate mode parameter in the block dialog box is set to Inherit from input port
by default so that the block inherits the sample rate of the speech signal from its input port.
Run the model. View the spectrum of the input signal and the filtered output in the spectrum analyzer.
Highpass Filter VariableSize Sinusoidal Signal
Highpass filter a sinusoidal signal whose sample rate and frame size vary during simulation.
Open and inspect the model. The input can be one of the two sinusoidal signals. The first sinusoidal signal is a 1 kHz sine wave with a sample rate of 44100 Hz and a frame size of 256. The second sinusoidal signal is a 10 kHz sine wave with a sample rate of 22050 Hz and a frame size of 128. The frame period of both the signals is the same (256/44100 or 128/22050). For more information on sample rate and frame period, see Sample and FrameBased Concepts. Using a manual switch, you can control which sine wave is input to the Highpass Filter block.
Since the input sample rate varies during simulation, specify the frequency specifications of the Highpass Filter block in normalized frequency units. In order to do that, set the Sample rate mode parameter in the Highpass Filter block dialog box to Use normalized frequency (0 to 1)
. Now set the passband edge frequency of the highpass filter to 0.5 in normalized frequency units.
Run the model. View the spectrum of the input and the filtered output in the spectrum analyzer.
This is the filtered output when you select the second sinusoidal signal.
Ports
Input
Port_1 — Input signal to filter
column vector  matrix
Input signal, specified as a real or complexvalued 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
 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 and complexity characteristics as the input. If the output has a fixedpoint data type, it is always signed.
Data Types: single
 double
 fixed point
Complex Number Support: Yes
Parameters
Main
Filter type — FIR or IIR filter
FIR
(default)  IIR
Specify whether the block implements an FIR highpass filter or an IIR highpass 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 minimum order. When you clear this check box, you can specify the Filter order as a positive integer.
Filter order — Order of highpass filter
50
(default)  positive integer
Specify the order of the highpass filter as a positive integer.
Dependencies
To enable this parameter, clear the Design minimum order filter check box.
Stopband edge frequency (Hz) — Stopband edge frequency
8e3
(default)  real positive scalar
Specify the stopband edge frequency of the highpass 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 the passband edge frequency.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 than the passband edge frequency.
(since R2023a)
Dependencies
To enable this parameter, select the Design minimum order filter check box.
Passband edge frequency (Hz) — Passband edge frequency
12e3
(default)  real positive scalar
Specify the passband edge frequency of the highpass 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)
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.
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.
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)
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
.
View Filter Response — Open Filter Visualization Tool
button
Opens the Filter Visualization Tool (fvtool
) and displays the
magnitude/phase response of the highpass 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.
Data Types
Rounding mode — Rounding method
Floor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Simplest
 Zero
Rounding method for the output fixedpoint operations.
Coefficients — Coefficient data type
fixdt(1,16)
(default)  fixdt(1,16,0)
 <data type expression>
Fixedpoint data type of the coefficients, specified as one of the following:
fixdt(1,16)
— Signed fixedpoint 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 fixedpoint data type of word length16
and fraction length0
. You can change the fraction length to any other integer value.<data type expression>
— 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 Specify Data Types Using Data Type Assistant (Simulink).
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

Algorithms
FIR Highpass 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 Type1 filter with a Direct form
structure.
IIR Highpass 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 highpass filter.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
The Highpass Filter block supports ARM Cortex code generation. To learn more about ARM Cortex code generation, see Code Generation for ARM CortexM and ARM CortexA Processors.
The Highpass Filter block also supports SIMD code generation using Intel AVX2 code replacement library 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. For more information, see SIMD Code Generation. To generate SIMD code from this block, see Use Intel AVX2 Code Replacement Library to Generate SIMD Code from Simulink Blocks.
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 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)