| DSP Blockset | ![]() |
Compute a window, and/or apply a window to an input signal
Library
Description
The Window Function block computes a window, and/or applies a window to an input signal. This block supports real and complex floating-point and fixed-point inputs.
Operation Modes
The Window Function block has three modes of operation that you can select via the Operation parameter. In each mode, the block first creates a window vector w by sampling the window specified in the Window type parameter at M discrete points. The operation modes are
In this mode, the block computes an M-by-1 window vector w and multiplies it element-wise with each of the N channels in the M-by-N input matrix u. This is equivalent to the following MATLAB code:
In this mode, a length-M 1-D vector input is treated as an M-by-1 matrix. The output y always has the same dimension as the input. If the input is frame based, the output is frame based; otherwise, the output is sample based.
In this mode the block generates a sample-based 1-D window vector w with length M specified by the Window length parameter. The In port is disabled for this mode.
In this mode, the block computes an M-by-1 window vector w and multiplies it element-wise with each of the N channels in the M-by-N input matrix u. This is equivalent to the following MATLAB code:
In this mode, a length-M 1-D vector input is treated as an M-by-1 matrix. The block produces two outputs:
Window Type
The available window types are shown in the table below. For complete information about the window functions, consult the Signal Processing Toolbox documentation.
| Window Type |
Description |
| Bartlett |
|
| Blackman |
|
| Boxcar |
Computes a rectangular window.
|
| Chebyshev |
Computes a Chebyshev window with stopband ripple
|
| Hamming |
|
| Hann |
Computes a Hann window (also known as a Hanning window).
|
| Hanning |
Obsolete. This window option is included only for compatibility with older models. Use the |
| Kaiser |
Computes a Kaiser window with Kaiser parameter
|
| Triang |
|
| User Defined |
Computes the user-defined window function specified by the entry in the Window function name parameter, |
Window Sampling
For the generalized-cosine windows (Blackman, Hamming, Hann, and Hanning), the Sampling parameter determines whether the window samples are computed in a periodic or a symmetric manner. For example, if Sampling is set to Symmetric, a Hamming window of length M is computed as
If Sampling is set to Periodic, the same window is computed as
Fixed-Point Data Types
The following diagram shows the data types used within the Window block for fixed-point signals for each of the three operating modes.
You can set the window, product output, and output data types in the block mask as discussed below.
Dialog Box
Continuous or Discrete, when it is in Generate Window mode. In the Apply window to output and Generate and apply window modes, the block inherits the sample time from its driving block. Therefore, this parameter is only visible when Generate window is selected for the Operation parameter.
Generate window and Discrete modes. In Apply window to output and Generate and apply window modes, the block inherits the sample time from its driving block. This parameter is only visible when Discrete is selected for the Sample mode parameter.
Generate window is selected for the Operation parameter. Otherwise, the window vector length is computed to match the input frame size, M.
Blackman, Hamming, Hann, or Hanning is selected for the Window type parameter. This is a tunable parameter.
Chebyshev is selected for the Window type parameter. This is a tunable parameter.
Kaiser window
parameter. Increasing
widens the mainlobe and decreases the amplitude of the window sidelobes in the window's frequency magnitude response. This parameter is only visible if Kaiser is selected for the Window type parameter. This parameter is tunable.
User defined is selected for the Window type parameter.
User defined is selected for the Window type parameter.
Parameters for Generate Window Only Mode
The following parameters are available when the Operation parameter is set to Generate window:

double or single from the drop-down list
Fixed-point to specify the output data type and scaling in the Word length, Set fraction length in output to, and Fraction length parameters
User-defined to specify the output data type and scaling in the User-defined data type, Set fraction length in output to, and Fraction length parameters
Inherit via back propagation to set the output data type and scaling to match the following block
Fixed-point is selected for the Output data type parameter.
ufix, sint, uint, sfrac, and ufrac functions from the Fixed-Point Blockset. This parameter is only visible if User-defined is selected for the Output data type parameter.
Best precision to have the output scaling automatically set such that the output signal has the best possible precision.
User-defined to specify the output scaling in the Fraction length parameter.
Fixed-point or User-defined is selected for the Output data type parameter, and if the specified output data type is a fixed-point data type.
Fixed-point or User-defined is selected for the Output data type parameter, and if User-defined is selected for the Set fraction length in output to parameter.
Parameters for Apply Window Modes
The following parameters are available when the Operation parameter is set to either Apply window to input or Generate and apply window.
w. If you select Same as input, these characteristics will match those of the input to the block. If you select User-defined, the Window word length and Window fraction length parameters become visible.
Nearest.
w. This parameter is only visible when User-defined is specified for the Fixed-point window attributes parameter.
w. This parameter is only visible when User-defined is specified for the Fixed-point window attributes parameter.
Same as input, these characteristics will match those of the input to the block. If you select User-defined, the Output word length and Output fraction length parameters become visible.
User-defined is specified for the Fixed-point output attributes parameter.
User-defined is specified for the Fixed-point output attributes parameter.

Same as output, the product output word and fraction lengths are the same as those of the output of the block. If you select User-defined, the Product output word length and Product output fraction length parameters become visible.
User-defined is specified for the Fixed-point product output attributes parameter.
User-defined is specified for the Fixed-point product output attributes parameter.
w does not obey this parameter; it always rounds to Nearest.
w does not obey this parameter; it is always saturated.
Supported Data Types
To learn how to convert your data types to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
| FFT |
DSP Blockset |
bartlett |
Signal Processing Toolbox |
blackman |
Signal Processing Toolbox |
rectwin |
Signal Processing Toolbox |
chebwin |
Signal Processing Toolbox |
hamming |
Signal Processing Toolbox |
hann |
Signal Processing Toolbox |
kaiser |
Signal Processing Toolbox |
triang |
Signal Processing Toolbox |
| Vector Scope | Yule-Walker AR Estimator | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |