Programmer Guide/Command Reference/EVAL/window: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
===== | Compute a window function used for signal windowing in sighnal processing algorithms. | ||
;Usage: '''<code>window(<var>type</var>, <var>x</var> {, <var>scale</var> {, <var>par</var>}})</code>''' | |||
:;<var>type</var>: selects the type of the window function (described below); must be number | |||
:;<var>x</var> | |||
::*if ''x'' is a scalar: The argument is used as window length and the result of '''window''' is a vector containing the window function. | |||
::*if ''x'' is a vector or matrix: The number of rows of ''x'' is used as window length and the result of '''window''' is a matrix with the same dimensions as ''x'' where each column contains the windowed values of the input column. | |||
:::The window length must be greater than 2! | |||
:'''<code>limitlow(<var>x</var>, <var>lo</var>)</code>''' | |||
:'''<code>limithigh(<var>x</var>, <var>hi</var>)</code>''' | |||
:;<var>x</var>: a scalar, vector or matrix | |||
:;<var>lo</var>: lower boundary, must be a number | |||
:;<var>hi</var>: upper boundary, must be a number | |||
;Result: The result ''r'' is a copy of ''x'' but the values of the elements of r are limited to the boundaries defined by ''lo'' and/or ''hi''. | |||
::''r''<sub>i,j</sub> is set to ''lo'' if x<sub>i,j</sub> is lower than ''lo'' (functions '''limit''' and '''limitlow''') | |||
::''r''<sub>i,j</sub> is set to ''hi'' if x<sub>i,j</sub> is greater than ''hi'' (functions '''limit''' and '''limithigh''') | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/vsubc|vsubc]], [[Programmer_Guide/Command_Reference/EVAL/select|select]] | |||
Example: | |||
<pre> | |||
#a := eval vv(1,2,3,4,5,4,3,2,1) | |||
#b := eval fill(9,0,1) | |||
#c := eval limitlow($#a, 3) | |||
// -> $#c = { 3 , 3 , 3 , 4 , 5 , 4 , 3 , 3 , 3 } | |||
#d := eval limit($#b, 2, 6) | |||
// -> $#d[*,0] = { 2 , 2 , 3 , 4 , 5 , 4 , 3 , 2 , 2 } | |||
// $#d[*,1] = { 2 , 2 , 2 , 3 , 4 , 5 , 6 , 6 , 6 } | |||
</pre> | |||
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] | |||
General window function | General window function |
Revision as of 16:31, 6 April 2011
Compute a window function used for signal windowing in sighnal processing algorithms.
- Usage
window(type, x {, scale {, par}})
- type
- selects the type of the window function (described below); must be number
- x
-
- if x is a scalar: The argument is used as window length and the result of window is a vector containing the window function.
- if x is a vector or matrix: The number of rows of x is used as window length and the result of window is a matrix with the same dimensions as x where each column contains the windowed values of the input column.
- The window length must be greater than 2!
limitlow(x, lo)
limithigh(x, hi)
- x
- a scalar, vector or matrix
- lo
- lower boundary, must be a number
- hi
- upper boundary, must be a number
- Result
- The result r is a copy of x but the values of the elements of r are limited to the boundaries defined by lo and/or hi.
- ri,j is set to lo if xi,j is lower than lo (functions limit and limitlow)
- ri,j is set to hi if xi,j is greater than hi (functions limit and limithigh)
Example:
#a := eval vv(1,2,3,4,5,4,3,2,1) #b := eval fill(9,0,1) #c := eval limitlow($#a, 3) // -> $#c = { 3 , 3 , 3 , 4 , 5 , 4 , 3 , 3 , 3 } #d := eval limit($#b, 2, 6) // -> $#d[*,0] = { 2 , 2 , 3 , 4 , 5 , 4 , 3 , 2 , 2 } // $#d[*,1] = { 2 , 2 , 2 , 3 , 4 , 5 , 6 , 6 , 6 }
General window function
Usage: | window(type, x, scale, par) |
Parameters: | |
type=0 -> none (square) | type=1 -> whanning |
type=2 -> whamming | type=3 -> wblackman |
type=4 -> wkaiser | type=5 -> wbartlett |
type=6 -> wtaprect | type=7 -> wnuttall |
type=8 -> wflattop | type=9 -> wgauss |
The arguments x, scale and par are the same as above.
arguments: x The window length (scalar, >2), the signal (vector or matrix, nrow(x)>2). If x is a matrix, every column is multiplied with the window. scale The scaling (0=unscaled, 1=scaled for rms(sig) ~ rms(sig * wnd) par optional window parameters
The result is the signal window of length x or the signal multiplied by the window.