SignalProcessing - Maple Programming Help

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

SignalProcessing

 CosineWindow
 multiply an array of samples by a cosine windowing function

 Calling Sequence CosineWindow( A, alpha )

Parameters

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

Options

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

Description

 • The CosineWindow( A, alpha ) command multiplies the Array A by the cosine windowing function, with parameter $\mathrm{\alpha }$, and returns the result in an Array having the same length.
 • The cosine windowing function $w\left(k\right)$ with parameter $\mathrm{\alpha }$ is defined as follows for a sample with $N$ points.

$w\left(k\right)={\mathrm{sin}\left(\frac{k\mathrm{\pi }}{N}\right)}^{\mathrm{\alpha }}$

 • 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[CosineWindow] 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{CosineWindow}\left(a,1.23\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{-}{0.000636524431347703}& {0.00111885011498206}& {-}{0.00310955873293638}& {0.00411034251214059}& {-}{0.000227586905885696}& {0.0000999183172626962}& {-}{0.00187084098729678}& {0.00784155424924526}& {0.00168029478583445}& {0.00292187193885634}& {-}{0.0112537701315634}& {0.0104932142306584}& {-}{0.0141862966326076}& {-}{0.0141782600915789}& {-}{0.0184819342243496}& {0.0225808446447159}& {-}{0.00945350843890105}& {-}{0.00895407803046600}& {0.00366076796042865}& {0.000760202547738337}& {-}{0.0181136079716951}& {-}{0.0182375938353344}& {0.0274360848127976}& {0.0156582526893675}& {0.0393762535526882}& {-}{0.0238517817517683}& {-}{0.0404581868791099}& {0.0174101312830906}& {-}{0.0348235644534715}& {0.0172097075999320}& {-}{0.00296240660174822}& {-}{0.0269920106251869}& {0.0448273347786348}& {-}{0.0299722249431609}& {0.0432681131093647}& {0.0621498706159233}& {-}{0.0487121800817760}& {-}{0.0223651237968499}& {0.0575728567607858}& {0.0662302941795619}& {-}{0.0732291963703288}& {-}{0.0522495716358767}& {-}{0.0384606028741554}& {0.0617798731713367}& {-}{0.0604973064165971}& {0.0400187993729286}& {0.0369920560206014}& {-}{0.0438867166018490}& {-}{0.0145120379351359}& {-}{0.0885964452768364}& {-}{0.0542476076135646}& {0.0817170468007105}& {0.0845679648036484}& {-}{0.0557607555248399}& {-}{0.0779643497110543}& {0.0444327245118756}& {-}{0.0357012200061180}& {0.0451702971675478}& {0.0303655567805665}& {-}{0.0139202793514839}& {0.0270077923872383}& {-}{0.0595705120036824}& {-}{0.0984004637268257}& {-}{0.0203071686393048}& {-}{0.0147621408149218}& {-}{0.0233962284126737}& {-}{0.0743800219616971}& {0.0693120059692936}& {-}{0.131124342439011}& {0.105423159533833}& {-}{0.140140356569515}& {-}{0.0233186032716544}& {-}{0.0868777403204223}& {-}{0.100632985915693}& {0.0773237724745494}& {-}{0.0857936281555811}& {0.0642400087744315}& {0.145335697979733}& {-}{0.0970865026435709}& {-}{0.0689479210787951}& {0.143525740147583}& {-}{0.150140158298233}& {0.175807071680542}& {0.0497063742939104}& {-}{0.176400784680131}& {0.115016973430024}& {0.0970136824426626}& {0.130510898104330}& {0.0959681283021219}& {-}{0.152946729069455}& {0.163990977765924}& {-}{0.106022644220051}& {0.0614327442929993}& {0.0143578039873986}& {-}{0.0659546714693986}& {-}{0.102442720925285}& {0.143726711072747}& {0.145096051985587}& {0.197331715418312}& {-}{0.0828032605490280}& {\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{CosineWindow}\left(\mathrm{Array}\left(1..N,'\mathrm{fill}'=1,'\mathrm{datatype}'={'\mathrm{float}'}_{8},'\mathrm{order}'='\mathrm{C_order}'\right),0.72,'\mathrm{container}'=c\right)$
 $\left[\begin{array}{cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc}{0.0155071307616718}& {0.0255429806461686}& {0.0342022618961238}& {0.0420733685657389}& {0.0494058163098257}& {0.0563356332660682}& {0.0629475008022849}& {0.0692987395818530}& {0.0754304697674257}& {0.0813734791957279}& {0.0871515903403516}& {0.0927837235094603}& {0.0982852279594548}& {0.103668777091399}& {0.108944991437438}& {0.114122884834324}& {0.119210191871773}& {0.124213613325065}& {0.129139003522589}& {0.133991515713138}& {0.138775716472855}& {0.143495676902921}& {0.148155046164925}& {0.152757111391948}& {0.157304846960726}& {0.161800955363036}& {0.166247901375797}& {0.170647940835478}& {0.175003145030586}& {0.179315421507207}& {0.183586531916738}& {0.187818107407860}& {0.192011661966651}& {0.196168604032049}& {0.200290246653688}& {0.204377816411288}& {0.208432461276738}& {0.212455257569275}& {0.216447216129443}& {0.220409287817279}& {0.224342368423715}& {0.228247303070527}& {0.232124890163002}& {0.235975884950070}& {0.239801002738919}& {0.243600921804516}& {0.247376286028986}& {0.251127707301120}& {0.254855767702339}& {0.258561021502078}& {0.262243996982675}& {0.265905198111367}& {0.269545106074905}& {0.273164180690434}& {0.276762861704716}& {0.280341569992400}& {0.283900708662834}& {0.287440664083877}& {0.290961806830263}& {0.294464492563241}& {0.297949062847546}& {0.301415845911103}& {0.304865157352344}& {0.308297300799513}& {0.311712568525927}& {0.315111242024744}& {0.318493592546501}& {0.321859881602329}& {0.325210361435515}& {0.328545275463837}& {0.331864858694860}& {0.335169338116210}& {0.338458933062667}& {0.341733855561726}& {0.344994310659194}& {0.348240496726198}& {0.351472605748914}& {0.354690823602191}& {0.357895330308161}& {0.361086300280838}& {0.364263902557633}& {0.367428301018632}& {0.370579654594425}& {0.373718117463223}& {0.376843839237919}& {0.379956965143735}& {0.383057636187020}& {0.386145989315740}& {0.389222157572163}& {0.392286270238191}& {0.395338452973783}& {0.398378827948857}& {0.401407513969058}& {0.404424626595726}& {0.407430278260405}& {0.410424578374183}& {0.413407633432154}& {0.416379547113269}& {0.419340420375817}& {0.422290351548781}& {\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[CosineWindow] command was introduced in Maple 18.