Window Function - Compute and/or apply window to input signal

Library

Signal Operations

dspsigops

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 TypeDescription

Bartlett

Computes a Bartlett window.

w = bartlett(M)

Blackman

Computes a Blackman window.

w = blackman(M)

Boxcar

Computes a rectangular window.

w = rectwin(M)

Chebyshev

Computes a Chebyshev window with stopband ripple R.

w = chebwin(M,R)

Hamming

Computes a Hamming window.

w = hamming(M)

Hann

Computes a Hann window (also known as a Hanning window).

w = hann(M)

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.

w = kaiser(M,beta)

Taylor

Computes a Taylor window.

w = taylorwin(M)

Triang

Computes a triangular window.

w = triang(M)

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, when Sampling is set to Symmetric, a Hamming window of length M is computed as

w = hamming(M)					% Symmetric (aperiodic) window

When Sampling is set to Periodic, the same window is computed as

w = hamming(M+1)					% Periodic (asymmetric) window
w = w(1:M)

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 dialog as discussed below.

Dialog Box

The Main pane of the Window Function block dialog appears as follows.

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. Tunable in simulation only.

Sample Mode

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 you select Generate window for the Operation parameter.

Sample time

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 you select Discrete for the Sample Mode parameter.

Window length

Specify the length of the window to apply. This parameter is only visible when you select Generate window 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 when you select Blackman, Hamming, Hann, or Hanning for the Window type parameter. Tunable in simulation only.

Stopband attenuation in dB

Specify the level of stopband attenuation, Rs, in decibels. This parameter is only visible when you select Chebyshev for the Window type parameter. Tunable in simulation only.

Beta

Specify the 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 when you select Kaiser for the Window type parameter. Tunable in simulation only.

Window function name

Specify the name of the user-defined window function to be calculated by the block. This parameter is only visible when you select User defined for the Window type parameter.

Specify additional arguments to the hamming function

Select to enable the Cell array of additional arguments parameter, when the user-defined window requires parameters other than the window length. This parameter is only visible when you select User defined for the Window type parameter.

Cell array of additional arguments

Specify the extra parameters required by the user-defined window function, besides the window length. This parameter is only available when you select the Specify additional arguments to the hamming function parameter. The entry must be a cell array.

The Data types pane of the Window block dialog is discussed in the following sections:

Parameters for Generate Window Only Mode

Parameters for Apply Window Modes

Parameters for Generate Window Only Mode

The Data types pane of the Window Function block dialog appears as follows when the Operation parameter is set to Generate window.

Output data type

Specify the output data type in one of the following ways:

Signed

Select to output a signed fixed-point signal. Otherwise, the signal is unsigned.

Word length

Specify the word length, in bits, of the fixed-point output data type. This parameter is only visible when you select Fixed-point 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 Simulink® Fixed Point™ functions sfix, ufix, sint, uint, sfrac, and ufrac. This parameter is only visible when you select User-defined 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:

This parameter is only visible when you select Fixed-point or User-defined for the Output data type parameter, and when the specified output data type is a fixed-point data type.

Fraction length

Specify the fraction length, in bits, of the fixed-point output data type. This parameter is only visible when you select Fixed-point or User-defined for the Output data type parameter and User-defined for the Set fraction length in output to parameter.

Parameters for Apply Window Modes

The Fixed-point pane of the Window Function block dialog appears as follows when the Operation parameter is set to either Apply window to input or Generate and apply window.

Rounding mode

Select the rounding mode for fixed-point operations.

The window vector w does not obey this parameter; it always rounds to Nearest.

Overflow mode

Select the overflow mode for fixed-point operations.

The window vector w does not obey this parameter; it is always saturated.

Window

Choose how you specify the word length and fraction length of the window vector w.

When you select Same word length as input, the word length of the window vector elements is the same as the word length of the input. The fraction length is automatically set to the best precision possible.

When you select Specify word length, you can enter the word length of the window vector elements in bits. The fraction length is automatically set to the best precision possible.

When you select Binary point scaling, you can enter the word length and the fraction length of the window vector elements in bits.

When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the window vector elements. This block requires power-of-two slope and a bias of zero.

The window vector does not obey the Rounding mode and Overflow mode parameters; it is always saturated and rounded to Nearest.

Product output

Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Fixed-Point Data Types for illustrations depicting the use of the product output data type in this block:

Output

Choose how you specify the word length and fraction length of the output of the block:

Lock scaling against changes by the autoscaling tool

Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling feature of the Fixed-Point Tool. See the fxptdlg reference page for more information.

Supported Data Types

See Also

FFTSignal Processing Blockset
bartlettSignal Processing Toolbox
blackmanSignal Processing Toolbox
rectwinSignal Processing Toolbox
chebwinSignal Processing Toolbox
hammingSignal Processing Toolbox
hannSignal Processing Toolbox
kaiserSignal Processing Toolbox
taylorwinSignal Processing Toolbox
triangSignal Processing Toolbox

  


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