SignalProcessing - Maple Programming Help

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

SignalProcessing

 TriangleWindow
 multiply an array of samples by a triangular windowing function

 Calling Sequence TriangleWindow(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 TriangleWindow(A) command multiplies the Array A by the triangular windowing function and returns the result in an Array having the same length.
 • The triangular windowing function $w\left(k\right)$ is defined as follows for a sample with $N$ points.

$'\mathrm{piecewise}'\left(1\le k\le m,\frac{k}{m},m

 • where $m=\frac{N}{2}$ for even $N$, and $m=\frac{N}{2}-\frac{1}{2}$ for odd $N$.
 • 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[TriangleWindow] command is thread-safe as of Maple 18.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$
 > $N≔1024:$
 > $a≔\mathrm{GenerateUniform}\left(N,-1,1\right)$
 ${a}{≔}\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{-}{0.785218492150308}& {0.588413964957000}& {-}{0.993165822699668}& {0.921578288543971}& {-}{0.0387801709584892}& {0.0136057925410569}& {-}{0.210756972897798}& {0.749600215815009}& {0.138966357801110}& {0.212285134010017}& {-}{0.727212007157506}& {0.609271531458945}& {-}{0.746508821379394}& {-}{0.681121068540962}& {-}{0.815677223727108}& {0.920580454170705}& {-}{0.357731881551445}& {-}{0.315850691869855}& {0.120832127984613}& {0.0235598362050951}& {-}{0.528712330386043}& {-}{0.502768306992949}& {0.716167932841928}& {0.387918812688441}& {0.927826197817923}& {-}{0.535605234093965}& {-}{0.867390423081817}& {0.356968106236309}& {-}{0.683916721958668}& {0.324222652241588}& {-}{0.0536105097271503}& {-}{0.469822424929590}& {0.751377623062582}& {-}{0.484332469291986}& {0.674785583745689}& {0.936373751610519}& {-}{0.709695004858078}& {-}{0.315371678676457}& {0.786426438484342}& {0.877079485449941}& {-}{0.940901432652028}& {-}{0.651838099118323}& {-}{0.466202749870718}& {0.728111944627018}& {-}{0.693676937371493}& {0.446705075912178}& {0.402212079148740}& {-}{0.465064398013056}& {-}{0.149959974456579}& {-}{0.893211717717351}& {-}{0.533857398666442}& {0.785364017821850}& {0.794103573076428}& {-}{0.511805256363005}& {-}{0.699780572205783}& {0.390154657885433}& {-}{0.306801157072187}& {0.380043311044574}& {0.250223507639021}& {-}{0.112387157976628}& {0.213712436612696}& {-}{0.462156727444381}& {-}{0.748708907514812}& {-}{0.151586118619889}& {-}{0.108139840420336}& {-}{0.168242880143225}& {-}{0.525201478973032}& {0.480703854002059}& {-}{0.893447801005097}& {0.705915172118695}& {-}{0.922403736039998}& {-}{0.150907000061125}& {-}{0.552928699180485}& {-}{0.630023401696236}& {0.476304094772787}& {-}{0.520089327357710}& {0.383331325836480}& {0.853844197466971}& {-}{0.561684322543443}& {-}{0.392888241447509}& {0.805707171559335}& {-}{0.830475841183217}& {0.958363623823972}& {0.267084791325033}& {-}{0.934454344213010}& {0.600780255626888}& {0.499754573684187}& {0.663151745684446}& {0.481067702174187}& {-}{0.756487140897663}& {0.800444356631489}& {-}{0.510770577006043}& {0.292151435278357}& {0.0674125049263240}& {-}{0.305776782333851}& {-}{0.469037371221931}& {0.649966387543828}& {0.648178403731437}& {0.870920942630620}& {-}{0.361100737471134}& {\mathrm{...}}& {"... 924 Array entries not shown"}\end{array}\right]$ (1)
 > $\mathrm{TriangleWindow}\left(a\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{-}{0.000383782254227912}& {0.000575184716478006}& {-}{0.00145625487199365}& {0.00180171708415244}& {-}{0.0000947707012670803}& {0.0000398996848711346}& {-}{0.000721064912162555}& {0.00293098813612907}& {0.000611288963934501}& {0.00103756174980458}& {-}{0.00390974197396508}& {0.00357344006720789}& {-}{0.00474321343007435}& {-}{0.00466065247290981}& {-}{0.00598003829711956}& {0.00719906513525478}& {-}{0.00297235678708434}& {-}{0.00277874508976412}& {0.00112209698519436}& {0.000230301429179815}& {-}{0.00542666614765734}& {-}{0.00540611082788117}& {0.00805076366342343}& {0.00455036730426323}& {0.0113370747533959}& {-}{0.00680632262289496}& {-}{0.0114465011843641}& {0.00488519402473933}& {-}{0.00969383427996157}& {0.00475399783345437}& {-}{0.000812280450411368}& {-}{0.00734815131854686}& {0.0121189939203642}& {-}{0.00804853565783359}& {0.0115432528988754}& {0.0164757844858156}& {-}{0.0128341716421060}& {-}{0.00585734300572109}& {0.0149905332848922}& {0.0171472040166166}& {-}{0.0188548185428803}& {-}{0.0133808407443644}& {-}{0.00979800500705811}& {0.0156583213898283}& {-}{0.0152568241357367}& {0.0100432226255915}& {0.00923947591397399}& {-}{0.0109106017129163}& {-}{0.00359141678806078}& {-}{0.0218282433459763}& {-}{0.0133072958611870}& {0.0199603758195191}& {0.0205706204169358}& {-}{0.0135080566195515}& {-}{0.0188113057044565}& {0.0106787198639219}& {-}{0.00854724631139524}& {0.0107734662954962}& {0.00721563389574890}& {-}{0.00329581108435858}& {0.00637168066147334}& {-}{0.0140047493164964}& {-}{0.0230540865950309}& {-}{0.00474169677012361}& {-}{0.00343552767708789}& {-}{0.00542718968203953}& {-}{0.0171986799077190}& {0.0159764721760215}& {-}{0.0301309375705531}& {0.0241515454781567}& {-}{0.0320091228049071}& {-}{0.00531051026608064}& {-}{0.0197281500685119}& {-}{0.0227867701493262}& {0.0174598275209966}& {-}{0.0193190561481847}& {0.0144264477465342}& {0.0325512450647232}& {-}{0.0216877133337889}& {-}{0.0153621990790815}& {0.0318974979942845}& {-}{0.0332839779946353}& {0.0388778987181768}& {0.0109653580016143}& {-}{0.0388214170371974}& {0.0252527380175525}& {0.0212505610510871}& {0.0285226557283633}& {0.0209262099186230}& {-}{0.0332765604500438}& {0.0356013863408922}& {-}{0.0229672009210928}& {0.0132796106944708}& {0.00309715320775878}& {-}{0.0141978466870557}& {-}{0.0220076185910583}& {0.0308146332315500}& {0.0310466684094236}& {0.0421413359337397}& {-}{0.0176491074032812}& {\mathrm{...}}& {"... 924 row vector entries not shown"}\end{array}\right]$ (2)
 > $c≔\mathrm{Array}\left(1..N,'\mathrm{datatype}'={'\mathrm{float}'}_{8},'\mathrm{order}'='\mathrm{C_order}'\right):$
 > $\mathrm{TriangleWindow}\left(\mathrm{Array}\left(1..N,'\mathrm{fill}'=1,'\mathrm{datatype}'={'\mathrm{float}'}_{8},'\mathrm{order}'='\mathrm{C_order}'\right),'\mathrm{container}'=c\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{0.000488758553274682}& {0.000977517106549365}& {0.00146627565982405}& {0.00195503421309873}& {0.00244379276637341}& {0.00293255131964809}& {0.00342130987292278}& {0.00391006842619746}& {0.00439882697947214}& {0.00488758553274682}& {0.00537634408602151}& {0.00586510263929619}& {0.00635386119257087}& {0.00684261974584555}& {0.00733137829912024}& {0.00782013685239492}& {0.00830889540566960}& {0.00879765395894428}& {0.00928641251221896}& {0.00977517106549365}& {0.0102639296187683}& {0.0107526881720430}& {0.0112414467253177}& {0.0117302052785924}& {0.0122189638318671}& {0.0127077223851417}& {0.0131964809384164}& {0.0136852394916911}& {0.0141739980449658}& {0.0146627565982405}& {0.0151515151515152}& {0.0156402737047898}& {0.0161290322580645}& {0.0166177908113392}& {0.0171065493646139}& {0.0175953079178886}& {0.0180840664711632}& {0.0185728250244379}& {0.0190615835777126}& {0.0195503421309873}& {0.0200391006842620}& {0.0205278592375367}& {0.0210166177908113}& {0.0215053763440860}& {0.0219941348973607}& {0.0224828934506354}& {0.0229716520039101}& {0.0234604105571848}& {0.0239491691104594}& {0.0244379276637341}& {0.0249266862170088}& {0.0254154447702835}& {0.0259042033235582}& {0.0263929618768328}& {0.0268817204301075}& {0.0273704789833822}& {0.0278592375366569}& {0.0283479960899316}& {0.0288367546432063}& {0.0293255131964809}& {0.0298142717497556}& {0.0303030303030303}& {0.0307917888563050}& {0.0312805474095797}& {0.0317693059628543}& {0.0322580645161290}& {0.0327468230694037}& {0.0332355816226784}& {0.0337243401759531}& {0.0342130987292278}& {0.0347018572825024}& {0.0351906158357771}& {0.0356793743890518}& {0.0361681329423265}& {0.0366568914956012}& {0.0371456500488759}& {0.0376344086021505}& {0.0381231671554252}& {0.0386119257086999}& {0.0391006842619746}& {0.0395894428152493}& {0.0400782013685239}& {0.0405669599217986}& {0.0410557184750733}& {0.0415444770283480}& {0.0420332355816227}& {0.0425219941348974}& {0.0430107526881720}& {0.0434995112414467}& {0.0439882697947214}& {0.0444770283479961}& {0.0449657869012708}& {0.0454545454545455}& {0.0459433040078201}& {0.0464320625610948}& {0.0469208211143695}& {0.0474095796676442}& {0.0478983382209189}& {0.0483870967741935}& {0.0488758553274682}& {\mathrm{...}}& {"... 924 row vector entries not shown"}\end{array}\right]$ (3)
 > $u≔{\mathrm{~}}_{\mathrm{log}}\left(\mathrm{FFT}\left(c\right)\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(\mathrm{ℜ}\left(u\right)\right),\mathrm{listplot}\left(\mathrm{ℑ}\left(u\right)\right)\right]\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end use}$

 > 

Compatibility

 • The SignalProcessing[TriangleWindow] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.