Window Function
Calculate and apply the window function to the input signal.
Description
The Window Function block has three modes of operation that allow you to apply a window function, calculate a window function, or calculate and apply a window function to an input signal. The mode can be selected using the Operation parameter. In each mode, the block first creates a window function vector, by sampling the window function specified in the Window type parameter.
Ports
Input
In - input signal
vector
| matrix
| multidimensional array
Input signal as a vector, matrix or multidimensional array.
If the input signal is represented by fixed-point data, it can only be signed.
This port is enabled only if Apply window to input
or Generate and apply window
is selected for the Operation parameter.
This port is unnamed if Apply window to input
is selected for Operation.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Support for complex numbers: yes
Output
Out - output signal
vector
| matrix
| multidimensional array
Output signal returned as a vector, matrix or multidimensional array.
The Out port is enabled only when Operation is set to a value:
Apply window to input
- the block calculates the window function vector of size M by 1 and applies it to the input M by N, where M is the number of lines in the input signal.
Generate and apply window
- the block generates the window function vector of size M by 1 and applies it to the input signal.
The output signal has the same dimensions as the input signal.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Win - output signal of the window function
vector
Output signal of the window function returned as a vector.
If the Operation parameter is set to Apply window to input
or Generate and apply window
, the window function vector has a length equal to the number of lines in the input signal. If the Operation parameter is set to Generate window
, the length of the window function vector is determined by the Window length parameter.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Parameters
Main
Operation - operation modes
Apply window to input (by default)
| Generate window
| Generate and apply window
The Window Function block has three modes of operation, which can be selected using the Operation parameter. In each mode, the block first creates a window function vector by sampling the window function specified in the Window type parameter at discrete points. The modes of operation are as follows:
-
Apply window to input
- in this mode, the block computes the window function vector of size M by 1 and applies it to the input. The output always has the same dimensionality as the input.If the input is an M by N matrix, the window function is elementwise multiplied by each of the N channels of the input matrix .
The window function is always applied to the first dimension:
An undirected vector of length M is treated as a vector M by 1.
-
Generate window
- in this mode the block generates undirected vector of window function of length M specified by parameter Window length. The In port is disabled for this mode. -
Generate and apply window
- in this mode the block generates a window function vector of length M by 1 and applies it to the input. The block has two outputs:-
Port Out - the output port to which the block outputs the result of multiplication y has the same dimensionality as the input.
-
Port Win - the output port to which the block outputs the vector of the window function w with dimension M by 1.
If the input is an M by N matrix, the window function is multiplied element by element by each of the N channels of the input matrix .
The window function is always applied to the first dimension:
The input one-dimensional vector of length M is treated as a vector M by 1.
-
Window type - type of window function
Hamming (by default)
| Bartlett
| Blackman
| …
The table below lists the available window function types.
Window function type | Description |
---|---|
|
Computes the Bartlett window function. w = bartlett(M) |
|
Computes the window function of Blackman. w = blackman(M) |
|
Computes a rectangular window function. w = rectwin(M) |
|
Computes the Chebyshev window function with stopband ripple R. w = chebwin(M,R) |
`Hamming'. |
Computes the Hamming window function. w = hamming(M) |
|
Computes the Hann window function (also known as the Hanning window function). w = hann(M) |
|
Computes the Kaiser window function with the Kaiser beta parameter. w = kaiser(M,beta) |
|
Computes a triangular window function. w = triang(M) |
Sampling - sampling type
Symmetric (by default)
| Periodic
Sampling type for generalised cosine window functions.
For generalised cosine window functions (Blackman
, Hamming
, Hann
and Hanning
), the Sampling parameter determines whether the window function samples periodically or symmetrically. For example, if the Sampling parameter is set to Symmetric
, the Hamming window function of length M is calculated as follows:
w = hamming(M) % Симметричная (апериодическая) оконная функция
If the Sampling parameter is set to Periodic
, the same window function is calculated as follows:
w = hamming(M+1) % Периодическая (асимметричная) оконная функция w = w(1:M)
Dependencies
To use this parameter, set the Window type parameter to Blackman
, Hamming
, Hann
or Hanning
.
Sample mode - sampling mode
Continuous (By default)
| Discrete
.
Sampling mode for the block, continuous or discrete, when it is in Generate window
mode. In Apply window to input
or Generate and apply window
modes, the block inherits the sampling mode from its control block.
Dependencies
To use this parameter, set the Operation parameter to Generate window
.
Sample time - interval between calculation steps
1 (By default)
| real scalar
| real scalar
Specify the interval between calculation steps for a block if the Operation parameter is set to Generate window
and Sample mode is set to Discrete
.
If Operation is set to Apply window to input
or Generate and apply window
, the block inherits the calculation interval from its control block.
Dependencies
To use this parameter, set the Sample mode parameter to `Discrete'.
Window length - window function length
64 (by default)
| positive integer
.
Specify the length of the window function to apply.
Dependencies
To use this parameter, set the Operation parameter to Generate window
. Otherwise, the length of the window function vector is calculated according to the length of the first measurement of the input signal.
Stopband attenuation in dB - stopband attenuation
50 (by default)
| non-negative scalar
.
Specify the stopband attenuation level Rs in decibels.
Dependencies
To use this parameter, set the Window type parameter to Chebyshev
.
Beta is the β parameter of the Kaiser window function
10 (by default)
| real scalar
Specify the parameter β of the Kaiser window function. Increasing β widens the main bandwidth and reduces the amplitude of the side lobes of the window function in its frequency response.
Dependencies
To use this parameter, set the Window type parameter to Kaiser
.