SignalProcessing - Maple Programming Help

Home : Support : Online Help : Science and Engineering : Signal Processing : Windowing Functions : SignalProcessing/BartlettWindow

SignalProcessing

 BartlettWindow
 multiply an array of samples by a Bartlett windowing function

 Calling Sequence BartlettWindow(A)

Parameters

 A - Array of real or complex numeric values; the signal

Options

 • container : Array, predefined Array for holding results
 • inplace : truefalse, specifies that output should overwrite input

Description

 • The BartlettWindow(A) command multiplies the Array A by the Bartlett (triangle) windowing function and returns the result in an Array having the same length. The length of A must be at least $3$.
 • The Bartlett windowing function $w\left(k\right)$ is defined as follows for a sample with $N$ points.

$w\left(k\right)=\left\{\begin{array}{cc}\frac{2k}{N-1}& 0\le k\le \frac{N}{2}-\frac{1}{2}\\ 2-\frac{2k}{N-1}& \frac{N}{2}-\frac{1}{2}\le k\le N-1\end{array}\right\$

 • For an Array with complex values, the real and imaginary parts are multiplied by the same windowing function.
 • Before the code performing the computation runs, A is converted to datatype float[8] or complex[8] if it does not have one of those datatypes already. For this reason, it is most efficient if A has one of these datatypes beforehand. This does not apply if inplace is true.
 • If the container=C option is provided, then the results are put into C and C is returned. With this option, no additional memory is allocated to store the result. The container must be an Array of the same size and datatype as A.
 • If the inplace or inplace=true option is provided, then A is overwritten with the results. In this case, the container option is ignored.

 • The SignalProcessing[BartlettWindow] command is thread-safe as of Maple 17.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $a≔\mathrm{GenerateUniform}\left(10,-1,1\right)$
 ${a}{≔}\left[\begin{array}{cccccccccc}{-}{0.785218492150308}& {0.588413964957000}& {-}{0.993165822699668}& {0.921578288543971}& {-}{0.0387801709584892}& {0.0136057925410569}& {-}{0.210756972897798}& {0.749600215815009}& {0.138966357801110}& {0.212285134010017}\end{array}\right]$ (1)
 > $\mathrm{BartlettWindow}\left(a\right)$
 $\left[\begin{array}{cccccccccc}{0.}& {0.130758658879333}& {-}{0.441407032310963}& {0.614385525695980}& {-}{0.0344712630742127}& {0.0120940378142728}& {-}{0.140504648598532}& {0.333155651473337}& {0.0308814128446911}& {0.}\end{array}\right]$ (2)
 > $c≔\mathrm{Array}\left(1..10,'\mathrm{datatype}'={'\mathrm{float}'}_{8},'\mathrm{order}'='\mathrm{C_order}'\right):$
 > $\mathrm{BartlettWindow}\left(a,'\mathrm{container}'=c\right)$
 $\left[\begin{array}{cccccccccc}{0.}& {0.130758658879333}& {-}{0.441407032310963}& {0.614385525695980}& {-}{0.0344712630742127}& {0.0120940378142728}& {-}{0.140504648598532}& {0.333155651473337}& {0.0308814128446911}& {0.}\end{array}\right]$ (3)
 > $c$
 $\left[\begin{array}{cccccccccc}{0.}& {0.130758658879333}& {-}{0.441407032310963}& {0.614385525695980}& {-}{0.0344712630742127}& {0.0120940378142728}& {-}{0.140504648598532}& {0.333155651473337}& {0.0308814128446911}& {0.}\end{array}\right]$ (4)
 > $a≔\mathrm{GenerateUniform}\left(100,-1,1\right):$
 > $\mathbf{use}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{plots}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{display}\left(\mathrm{Array}\left(\left[\mathrm{listplot}\left(a\right),\mathrm{listplot}\left(\mathrm{BartlettWindow}\left(a\right)\right)\right]\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end use}$

 > 

Compatibility

 • The SignalProcessing[BartlettWindow] command was introduced in Maple 17.