SignalProcessing - Maple Programming Help

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

SignalProcessing

 BartlettHannWindow
 multiply an array of samples by a Bartlett-Hann windowing function

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

$w\left(k\right)=0.62-0.48\left|\frac{2k-N}{2N}\right|-0.38\mathrm{cos}\left(\frac{2k\mathrm{\pi }}{N}\right)$

 • 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[BartlettHannWindow] 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{BartlettHannWindow}\left(a\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{-}{0.000373688144357143}& {0.000568474558117135}& {-}{0.00146057837883801}& {0.00183343290823502}& {-}{0.0000978257481936887}& {0.0000417696995137823}& {-}{0.000765408934015436}& {0.00315411279904922}& {0.000666764667880832}& {0.00114689529468134}& {-}{0.00437889595688980}& {0.00405447445601324}& {-}{0.00545103448934274}& {-}{0.00542424887402180}& {-}{0.00704715145383216}& {0.00858883507940459}& {-}{0.00358955793985019}& {-}{0.00339629555417174}& {0.00138784269509866}& {0.000288202218995709}& {-}{0.00687011107636419}& {-}{0.00692286746826558}& {0.0104267821086333}& {0.00595956809653164}& {0.0150130390452529}& {-}{0.00911223101327794}& {-}{0.0154908756663501}& {0.00668226299885806}& {-}{0.0134006060450039}& {0.00664086284357371}& {-}{0.00114645966437441}& {-}{0.0104777887138495}& {0.0174561845494639}& {-}{0.0117096572548194}& {0.0169611106880958}& {0.0244470243684238}& {-}{0.0192290332485945}& {-}{0.00886046765250652}& {0.0228926938692457}& {0.0264335301053111}& {-}{0.0293376399174576}& {-}{0.0210129404278312}& {-}{0.0155275176263858}& {0.0250398389473086}& {-}{0.0246169410461328}& {0.0163489155758433}& {0.0151730201354074}& {-}{0.0180736453569775}& {-}{0.00600066428086913}& {-}{0.0367835345609637}& {-}{0.0226147023206962}& {0.0342059732712757}& {0.0355450490400419}& {-}{0.0235336841300247}& {-}{0.0330406546880178}& {0.0189081647666924}& {-}{0.0152554559119276}& {0.0193817054880690}& {0.0130833154931855}& {-}{0.00602257340194561}& {0.0117333053337719}& {-}{0.0259871603292464}& {-}{0.0431041885483356}& {-}{0.00893232992110228}& {-}{0.00652012028273773}& {-}{0.0103762511567986}& {-}{0.0331235157176569}& {0.0309935217566031}& {-}{0.0588741519092396}& {0.0475283271546155}& {-}{0.0634382083731932}& {-}{0.0105988125979032}& {-}{0.0396484093270937}& {-}{0.0461121707173938}& {0.0355747123062514}& {-}{0.0396306848128911}& {0.0297937507889531}& {0.0676752165740237}& {-}{0.0453887847901679}& {-}{0.0323621728437501}& {0.0676343665778469}& {-}{0.0710313164083910}& {0.0835023741697212}& {0.0237016234324419}& {-}{0.0844430664030559}& {0.0552734745260377}& {0.0468029220460478}& {0.0632070673615409}& {0.0466571758547755}& {-}{0.0746444975587855}& {0.0803410154972592}& {-}{0.0521397900602177}& {0.0303261541228524}& {0.00711452107619017}& {-}{0.0328047598607730}& {-}{0.0511445607189212}& {0.0720238366809451}& {0.0729807172052775}& {0.0996222901946491}& {-}{0.0419572953041109}& {\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{BartlettHannWindow}\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.000475903392613442}& {0.000966113301132610}& {0.00147062891760391}& {0.00198944889547226}& {0.00252257134963130}& {0.00306999385649442}& {0.00363171345408630}& {0.00420772664215402}& {0.00479802938229923}& {0.00540261709813000}& {0.00602148467543301}& {0.00665462646236648}& {0.00730203626967241}& {0.00796370737091007}& {0.00863963250270899}& {0.00932980386504267}& {0.0100342131215218}& {0.0107528513997087}& {0.0114857092914509}& {0.0122327768532356}& {0.0129940436065638}& {0.0137694985383450}& {0.0145591301013120}& {0.0153629262144553}& {0.0161808742634782}& {0.0170129611012713}& {0.0178591730484082}& {0.0187194958936597}& {0.0195939148945297}& {0.0204824147778095}& {0.0213849797401534}& {0.0223015934486731}& {0.0232322390415531}& {0.0241768991286854}& {0.0251355557923242}& {0.0261081905877605}& {0.0270947845440166}& {0.0280953181645603}& {0.0291097714280387}& {0.0301381237890323}& {0.0311803541788287}& {0.0322364410062151}& {0.0333063621582921}& {0.0343900950013057}& {0.0354876163814992}& {0.0365989026259856}& {0.0377239295436385}& {0.0388626724260027}& {0.0400151060482251}& {0.0411812046700036}& {0.0423609420365568}& {0.0435542913796121}& {0.0447612254184138}& {0.0459817163607500}& {0.0472157359039994}& {0.0484632552361958}& {0.0497242450371143}& {0.0509986754793740}& {0.0522865162295616}& {0.0535877364493734}& {0.0549023047967762}& {0.0562301894271870}& {0.0575713579946728}& {0.0589257776531676}& {0.0602934150577091}& {0.0616742363656949}& {0.0630682072381554}& {0.0644752928410479}& {0.0658954578465673}& {0.0673286664344763}& {0.0687748822934542}& {0.0702340686224637}& {0.0717061881321371}& {0.0731912030461793}& {0.0746890751027906}& {0.0761997655561074}& {0.0777232351776604}& {0.0792594442578520}& {0.0808083526074511}& {0.0823699195591064}& {0.0839441039688774}& {0.0855308642177832}& {0.0871301582133699}& {0.0887419433912949}& {0.0903661767169301}& {0.0920028146869810}& {0.0936518133311259}& {0.0953131282136703}& {0.0969867144352203}& {0.0986725266343733}& {0.100370518989425}& {0.102080645220096}& {0.103802858589273}& {0.105537111904768}& {0.107283357521096}& {0.109041547341271}& {0.110811632818610}& {0.112593564958570}& {0.114387294320584}& {0.116192771019929}& {\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[BartlettHannWindow] command was introduced in Maple 18.