DSP Blockset Previous page   Next Page
Window Function

Compute a window, and/or apply a window to an input signal

Library

Signal Operations

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

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

Computes a Bartlett window.

Blackman

Computes a Blackman window.

Boxcar

Computes a rectangular window.

Chebyshev

Computes a Chebyshev window with stopband ripple R.

Hamming

Computes a Hamming window.

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 Hann option instead of Hanning whenever possible.

Kaiser

Computes a Kaiser window with Kaiser parameter beta.

Triang

Computes a triangular window.

User Defined

Computes the user-defined window function specified by the entry in the Window function name parameter, usrwin.

  • w = usrwin(M) % Window takes no extra parameters
    w = usrwin(M,x1,...,xn) % Window takes extra 
    parameters {x1 ... xn}
    

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

Operation
Specify the block's operation as discussed in Operation Modes. The port configuration of the block is updated to match the setting of this parameter.
Window type
Specify the type of window to apply as listed in Window Type. This is a tunable parameter.
Sample mode
(Not shown in dialog above.) Specify the sample mode for the block, 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.
Sample time
(Not shown in dialog above.) Specify the sample time for the block when it is in 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.
Window length
(Not shown in dialog above.) Specify the length of the window to apply. This parameter is only visible when Generate window is selected for the Operation parameter. Otherwise, the window vector length is computed to match the input frame size, M.
Sampling
Specify the window sampling for generalized-cosine windows. This parameter is only visible if Blackman, Hamming, Hann, or Hanning is selected for the Window type parameter. This is a tunable parameter.
Stopband attenuation in dB
(Not shown in dialog above.) Specify the level of stopband attenuation, Rs, in decibels. This parameter is only visible if Chebyshev is selected for the Window type parameter. This is a tunable parameter.
Beta
(Not shown in dialog above.) Specify the Kaiser window beta parameter. Increasing beta 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.
Window function name
(Not shown in dialog above.) Specify the name of the user-defined window function to be calculated by the block. This parameter is only visible if User defined is selected for the Window type parameter.
Additional parameters for user defined window
(Not shown in dialog above.) Select to enable the Window function parameters parameter, when the user-defined window requires parameters other than the window length. This parameter is only visible if User defined is selected for the Window type parameter.
Window function parameters
(Not shown in dialog above.) Specify the extra parameters required by the user-defined window function, besides the window length. This parameter is only available when the Additional parameters for user defined window parameter is selected. The entry must be a cell array.
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown in the sections below:

Parameters for Generate Window Only Mode

The following parameters are available when the Operation parameter is set to Generate window:

Allow overrides from DSP Fixed-Point Attributes blocks
If you select this parameter, fixed-point data types for this block may be set by DSP Fixed-Point Attributes blocks in your model. If this parameter is unselected, the data types are always set by the parameters in the block mask.
Output data type
Specify the output data type in one of the following ways:
Word length
Specify the word length, in bits, of the fixed-point output data type. This parameter is only visible if Fixed-point is selected for the Output data type parameter.
User-defined data type
Specify any built-in or fixed-point data type. You can specify fixed-point data types using the sfix, 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.
Set fraction length in output to
Specify the scaling of the fixed-point output by either of the following two methods:
Fraction length
Specify the fraction length, in bits, of the fixed-point output data type. This parameter is only visible if 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.

Allow overrides from DSP Fixed-Point Attributes blocks
If you select this parameter, fixed-point data types for this block may be set by DSP Fixed-Point Attributes blocks in your model. If this parameter is unselected, the data types are always set by the parameters in the block mask.
Fixed-point window attributes
Choose how you will specify the word length and fraction length of the window vector 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.
The window vector does not obey the Round integer calculations toward and Saturate on integer overflow parameters; it is always saturated and rounded to Nearest.
Window word length
Specify the word length, in bits, of the data type and scaling of the window vector, w. This parameter is only visible when User-defined is specified for the Fixed-point window attributes parameter.
Window fraction length
Specify the fraction length, in bits, of the data type and scaling of the window vector, w. This parameter is only visible when User-defined is specified for the Fixed-point window attributes parameter.
Fixed-point output attributes
Choose how you will specify the output word length and fraction length. If you select 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.
Output word length
Specify the word length, in bits, of the output. This parameter is only visible if User-defined is specified for the Fixed-point output attributes parameter.
Output fraction length
Specify the fraction length, in bits, of the output. This parameter is only visible if User-defined is specified for the Fixed-point output attributes parameter.
Fixed-point product output attributes

As depicted above, the output of the multiplier is placed into the product output data type and scaling. Use this parameter to specify how you would like to designate this product output word and fraction lengths.
If you select 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.
Product output word length
Specify the word length, in bits, of the product output. This parameter is only visible when User-defined is specified for the Fixed-point product output attributes parameter.
Product output fraction length
Specify the fraction length, in bits, of the product output. This parameter is only visible when User-defined is specified for the Fixed-point product output attributes parameter.
Round integer calculations toward
Select the rounding mode for fixed-point operations.
The window vector w does not obey this parameter; it always rounds to Nearest.
Saturate on integer overflow
If selected, overflows saturate.
The window vector 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


Previous page  Vector Scope Yule-Walker AR Estimator Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS