0% found this document useful (0 votes)
399 views10 pages

Understanding FFTs and Windowing - National Instruments

This document provides an overview of fast Fourier transforms (FFTs) and windowing. It explains that FFTs take a signal in the time domain and decompose it into its constituent frequencies, allowing analysis of what frequencies are present. Windowing is used to minimize spectral leakage that occurs when an FFT is performed on a non-integer number of signal periods. Common applications of FFTs include analyzing radio waves, audio signals, and earthquakes. FFTs displayed on oscilloscopes can help validate circuits by identifying unwanted noise or jitter in signals.

Uploaded by

Dio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
399 views10 pages

Understanding FFTs and Windowing - National Instruments

This document provides an overview of fast Fourier transforms (FFTs) and windowing. It explains that FFTs take a signal in the time domain and decompose it into its constituent frequencies, allowing analysis of what frequencies are present. Windowing is used to minimize spectral leakage that occurs when an FFT is performed on a non-integer number of signal periods. Common applications of FFTs include analyzing radio waves, audio signals, and earthquakes. FFTs displayed on oscilloscopes can help validate circuits by identifying unwanted noise or jitter in signals.

Uploaded by

Dio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

UnderstandingFFTsandWindowing
PublishDate:may04,2015

Overview

Learnaboutthetimeandfrequencydomain,fastFouriertransforms(FFTs),andwindowingaswellashowyoucanusethem
toimproveyourunderstandingofasignal.ThistutorialispartoftheInstrumentFundamentalsseries.
TableofContents

1.UnderstandingtheTimeDomain,FrequencyDomain,andFFT
2.Windowing
3.Summary
4.AdditionalInstrumentationResources
1.UnderstandingtheTimeDomain,FrequencyDomain,andFFT

TheFouriertransformcanbepowerfulinunderstandingeverydaysignalsandtroubleshootingerrorsinsignals.Althoughthe
Fouriertransformisacomplicatedmathematicalfunction,itisntacomplicatedconcepttounderstandandrelatetoyour
measuredsignals.Essentially,ittakesasignalandbreaksitdownintosinewavesofdifferentamplitudesandfrequencies.
Letstakeadeeperlookatwhatthismeansandwhyitisuseful.

AllSignalAretheSumofSines

Whenlookingatrealworldsignals,youusuallyviewthemasavoltagechangingovertime.Thisisreferredtoasthetime
domain.Fourierstheoremstatesthatanywaveforminthetimedomaincanberepresentedbytheweightedsumofsines
andcosines.Forexample,taketwosinewaves,whereoneisthreetimesasfastastheotherorthefrequencyis1/3the
firstsignal.Whenyouaddthem,youcanseeyougetadifferentsignal.

Figure1.Whenyouaddtwosignals,yougetanewsignal.

Nowimagineifthatsecondwavewasalso1/3theamplitude.Thistime,justthepeaksareaffected.

http://www.ni.com/whitepaper/4844/en/

1/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure2.Adjustingtheamplitudewhenaddingsignalsaffectsthepeaks.

Imagineyouaddedathirdsignalthatwas1/5theamplitudeandfrequencyoftheoriginalsignal.Ifyoucontinuedinthis
fashionuntilyouhitthenoisefloor,youmightrecognizetheresultingwaveform.

Figure3.Asquarewaveisthesumofsines.

Youhavenowcreatedasquarewave.Inthisway,allsignalsinthetimedomaincanberepresentedbyaseriesofsines.

Althoughitisprettyneatthatyoucanconstructsignalsinthisfashion,whydoyouactuallycare?Becauseifyoucan
constructasignalusingsines,youcanalsodeconstructsignalsintosines.Onceasignalisdeconstructed,youcanthen
seeandanalyzethedifferentfrequenciesthatarepresentintheoriginalsignal.Takealookatafewexampleswhere
beingabletodeconstructasignalhasprovenuseful:

Ifyoudeconstructradiowaves,youcanchoosewhichparticularfrequencyorstationyouwanttolistento.
Ifyoudeconstructaudiowavesintodifferentfrequenciessuchasbassandtreble,youcanalterthetonesor
frequenciestoboostcertainsoundstoremoveunwantednoise.
Ifyoudeconstructearthquakevibrationsofvaryingspeedsandstrengths,youcanoptimizebuildingdesignstoavoid
thestrongestvibrations.
Ifyoudeconstructcomputerdata,youcanignoretheleastimportantfrequenciesandleadtomorecompact
representationsinmemory,otherwiseknownasfilecompression.

DeconstructingSignalsUsingtheFFT

TheFouriertransformdeconstructsatimedomainrepresentationofasignalintothefrequencydomainrepresentation.
Thefrequencydomainshowsthevoltagespresentatvaryingfrequencies.Itisadifferentwaytolookatthesamesignal.
http://www.ni.com/whitepaper/4844/en/

2/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Adigitizersamplesawaveformandtransformsitintodiscretevalues.Becauseofthistransformation,theFourier
transformwillnotworkonthisdata.Instead,thediscreteFouriertransform(DFT)isused,whichproducesasitsresultthe
frequencydomaincomponentsindiscretevalues,orbins.ThefastFourier(FFT)isanoptimizedimplementationofa
DFTthattakeslesscomputationtoperformbutessentiallyjustdeconstructsasignal.

TakealookatthesignalfromFigure1above.Therearetwosignalsattwodifferentfrequenciesinthiscase,thesignal
hastwospikesinthefrequencydomainoneateachofthetwofrequenciesofthesinesthatcomposedthesignalinthe
firstplace.

Figure4.Whentwosinewavesofequalamplitudeareadded,theyresultintwospikesinthefrequencydomain.

Theamplitudeoftheoriginalsignalisrepresentedontheverticalaxis.IfyoulookatthesignalfromFigure2abovewhere
therearetwodifferentsignalsatdifferentamplitudes,youcanseethatthemostprominentspikecorrespondstothe
frequencyofthehighestvoltagesinesignal.Lookingatasignalinthetimedomain,youcangetagoodideaofthe
originalsignalbyknowingatwhatfrequenciesthelargestvoltagesignalsoccur.

Figure5.Thehighestspikeisthefrequencyofthelargestamplitude.

Itcanalsobehelpfultolookattheshapeofthesignalinthefrequencydomain.Forinstance,letstakealookatthe
squarewaveinthefrequencydomain.Wecreatedthesquarewaveusingmanysinewavesatvaryingfrequenciesas
such,youwouldexpectmanyspikesinthesignalinthefrequencydomainoneforeachsignaladded.Ifyouseeanice
rampinthefrequencydomain,youknowtheoriginalsignalwasasquarewave.

http://www.ni.com/whitepaper/4844/en/

3/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure6.Thefrequencydomainofasinewavelookslikearamp.

Sowhatdoesthislooklikeintherealworld?Manymixedsignaloscilloscopes(MSO)haveanFFTfunction.Below,you
canseewhatanFFTofasquarewavelookslikeonamixedsignalgraph.Ifyouzoomin,youcanactuallyseethe
individualspikesinthefrequencydomain.

Figure7.TheoriginalsinewaveanditscorrespondingFFTaredisplayedinthetopimage,whilethebottomimageisa
zoomedinportionoftheFFTwhereyoucanseetheindividualspikes.

Lookingatsignalsinthefrequencydomaincanhelpwhenvalidatingandtroubleshootingsignals.Forinstance,sayyou
haveacircuitthatissupposedtooutputasinewave.Youcanviewtheoutputsignalontheoscilloscopeinthetime
domaininFigure8below.Itlooksprettygood!

http://www.ni.com/whitepaper/4844/en/

4/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure8.Ifthesetwowaveswereadded,theywouldlooklikeaperfectsinewavebecausetheyaresosimilar.

However,whenyouviewthesignalinthefrequencydomain,youexpectonlyonespikebecauseyouareexpectingto
outputasinglesinewaveatonlyonefrequency.However,youcanseethatthereisasmallerspikeatahigherfrequency
thisistellingyouthatthesinewaveisntasgoodasyouthought.Youcanworkwiththecircuittoeliminatethecauseofthe
noiseaddedatthatparticularfrequency.Thefrequencydomainisgreatatshowingifacleansignalinthetimedomain
actuallycontainscrosstalk,noise,orjitter.

Figure9.LookingattheseeminglyperfectsinewavefromFigure8,youcanseeherethatthereisactuallyaglitch.

2.Windowing

AlthoughperforminganFFTonasignalcanprovidegreatinsight,itisimportanttoknowthelimitationsoftheFFTandhowto
improvethesignalclarityusingwindowing.

WhatisWindowing

WhenyouusetheFFTtomeasurethefrequencycomponentofasignal,youarebasingtheanalysisonafinitesetof
data.TheactualFFTtransformassumesthatitisafinitedataset,acontinuousspectrumthatisoneperiodofaperiodic
signal.FortheFFT,boththetimedomainandthefrequencydomainarecirculartopologies,sothetwoendpointsofthe
timewaveformareinterpretedasthoughtheywereconnectedtogether.Whenthemeasuredsignalisperiodicandan
integernumberofperiodsfilltheacquisitiontimeinterval,theFFTturnsoutfineasitmatchesthisassumption.

http://www.ni.com/whitepaper/4844/en/

5/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure10.Measuringanintegernumberofperiods(top)givesanidealFFT(bottom).

However,manytimes,themeasuredsignalisntanintegernumberofperiods.Therefore,thefinitenessofthemeasured
signalmayresultinatruncatedwaveformwithdifferentcharacteristicsfromtheoriginalcontinuoustimesignal,andthe
finitenesscanintroducesharptransitionchangesintothemeasuredsignal.Thesharptransitionsarediscontinuities.

Whenthenumberofperiodsintheacquisitionisnotaninteger,theendpointsarediscontinuous.Theseartificial
discontinuitiesshowupintheFFTashighfrequencycomponentsnotpresentintheoriginalsignal.Thesefrequencies
canbemuchhigherthantheNyquistfrequencyandarealiasedbetween0andhalfofyoursamplingrate.Thespectrum
yougetbyusingaFFT,therefore,isnottheactualspectrumoftheoriginalsignal,butasmearedversion.Itappearsasif
energyatonefrequencyleaksintootherfrequencies.Thisphenomenonisknownasspectralleakage,whichcausesthe
finespectrallinestospreadintowidersignals.

Figure11.Measuringanonintegernumberofperiods(top)addsspectralleakagetotheFFT(bottom).

YoucanminimizetheeffectsofperforminganFFToveranonintegernumberofcyclesbyusingatechniquecalled
windowing.Windowingreducestheamplitudeofthediscontinuitiesattheboundariesofeachfinitesequenceacquiredby
thedigitizer.Windowingconsistsofmultiplyingthetimerecordbyafinitelengthwindowwithanamplitudethatvaries
smoothlyandgraduallytowardzeroattheedges.Thismakestheendpointsofthewaveformmeetand,therefore,results
inacontinuouswaveformwithoutsharptransitions.Thistechniqueisalsoreferredtoasapplyingawindow.

http://www.ni.com/whitepaper/4844/en/

6/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure12.Applyingawindowminimizestheeffectofspectralleakage.

WindowingFunctions

Thereareseveraldifferenttypesofwindowfunctionsthatyoucanapplydependingonthesignal.Tounderstandhowa
givenwindowaffectsthefrequencyspectrum,youneedtounderstandmoreaboutthefrequencycharacteristicsof
windows.

Anactualplotofawindowshowsthatthefrequencycharacteristicofawindowisacontinuousspectrumwithamainlobe
andseveralsidelobes.Themainlobeiscenteredateachfrequencycomponentofthetimedomainsignal,andtheside
lobesapproachzero.Theheightofthesidelobesindicatestheaffectthewindowingfunctionhasonfrequenciesaround
mainlobes.Thesideloberesponseofastrongsinusoidalsignalcanoverpowerthemainloberesponseofanearby
weaksinusoidalsignal.Typically,lowersidelobesreduceleakageinthemeasuredFFTbutincreasethebandwidthofthe
majorlobe.Thesideloberolloffrateistheasymptoticdecayrateofthesidelobepeaks.Byincreasingthesideloberoll
offrate,youcanreducespectralleakage.

Selectingawindowfunctionisnotasimpletask.Eachwindowfunctionhasitsowncharacteristicsandsuitabilityfor
differentapplications.Tochooseawindowfunction,youmustestimatethefrequencycontentofthesignal.
Ifthesignalcontainsstronginterferingfrequencycomponentsdistantfromthefrequencyofinterest,choosea
smoothingwindowwithahighsideloberolloffrate.
Ifthesignalcontainsstronginterferingsignalsnearthefrequencyofinterest,chooseawindowfunctionwithalow
maximumsidelobelevel.
Ifthefrequencyofinterestcontainstwoormoresignalsveryneartoeachother,spectralresolutionisimportant.In
thiscase,itisbesttochooseasmoothingwindowwithaverynarrowmainlobe.
Iftheamplitudeaccuracyofasinglefrequencycomponentismoreimportantthantheexactlocationofthe
componentinagivenfrequencybin,chooseawindowwithawidemainlobe.
Ifthesignalspectrumisratherflatorbroadbandinfrequencycontent,usetheuniformwindow,ornowindow.
Ingeneral,theHanning(Hann)windowissatisfactoryin95percentofcases.Ithasgoodfrequencyresolutionand
reducedspectralleakage.Ifyoudonotknowthenatureofthesignalbutyouwanttoapplyasmoothingwindow,start
withtheHannwindow.

Evenifyouusenowindow,thesignalisconvolvedwitharectangularshapedwindowofuniformheight,bythenatureof
takingasnapshotintimeoftheinputsignalandworkingwithadiscretesignal.Thisconvolutionhasasinefunction
characteristicspectrum.Forthisreason,nowindowisoftencalledtheuniformorrectangularwindowbecausethereis
stillawindowingeffect.

TheHammingandHannwindowfunctionsbothhaveasinusoidalshape.Bothwindowsresultinawidepeakbutlowside
lobes.However,theHannwindowtoucheszeroatbothendseliminatingalldiscontinuity.TheHammingwindowdoesnt
quitereachzeroandthusstillhasaslightdiscontinuityinthesignal.Becauseofthisdifference,theHammingwindow
http://www.ni.com/whitepaper/4844/en/

7/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

doesabetterjobofcancellingthenearestsidelobebutapoorerjobofcancelinganyothers.Thesewindowfunctionsare
usefulfornoisemeasurementswherebetterfrequencyresolutionthansomeoftheotherwindowsiswantedbut
moderatesidelobesdonotpresentaproblem.

Figure13.HammingandHannwindowingresultinawidepeakbutnicelowsidelobes.

TheBlackmanHarriswindowissimilartoHammingandHannwindows.Theresultingspectrumhasawidepeak,but
goodsidelobecompression.Therearetwomaintypesofthiswindow.The4termBlackmanHarrisisagoodgeneral
purposewindow,havingsideloberejectioninthehigh90sdBandamoderatelywidemainlobe.The7termBlackman
Harriswindowfunctionhasallthedynamicrangeyoushouldeverneed,butitcomeswithawidemainlobe.

http://www.ni.com/whitepaper/4844/en/

8/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

Figure14.TheBlackmanHarrisresultsinawidepeak,butgoodsidelobecompression.

AKaiserBesselwindowstrikesabalanceamongthevariousconflictinggoalsofamplitudeaccuracy,sidelobedistance,
andsidelobeheight.ItcomparesroughlytotheBlackmanHarriswindowfunctions,butforthesamemainlobewidth,the
nearsidelobestendtobehigher,butthefurtheroutsidelobesarelower.Choosingthiswindowoftenrevealssignals
closetothenoisefloor.

Theflattopwindowissinusoidalaswell,butitactuallycrossesthezeroline.Thiscausesamuchbroaderpeakinthe
frequencydomain,whichisclosertothetrueamplitudeofthesignalthanwithotherwindows.

Figure15.Theflattopwindowresultsinmoreaccurateamplitudeinformation.

Thesearejustafewofthepossiblewindowfunctions.Thereisnouniversalapproachforselectingawindowfunction.
However,thetablebelowcanhelpyouinyourinitialchoice.Alwayscomparetheperformanceofdifferentwindow
functionstofindthebestonefortheapplication.

http://www.ni.com/whitepaper/4844/en/

9/10

7/10/2016

UnderstandingFFTsandWindowingNationalInstruments

3.Summary

Allsignalsinthetimedomaincanberepresentedbyaseriesofsines.
AnFFTtransformdeconstructsatimedomainrepresentationofasignalintothefrequencydomainrepresentationto
analyzethedifferentfrequenciesinasignal.
Thefrequencydomainisgreatatshowingyouifacleansignalinthetimedomainactuallycontainscrosstalk,noise,or
jitter.
Spectralleakageiscausedbydiscontinuitiesintheoriginal,nonintegernumberofperiodsinasignalandcanbeimproved
usingwindowing.
Windowingreducestheamplitudeofthediscontinuitiesattheboundariesofeachfinitesequenceacquiredbythedigitizer.
Nowindowisoftencalledtheuniformorrectangularwindowbecausethereisstillawindowingeffect.
Ingeneral,theHanningwindowissatisfactoryin95percentofcases.Ithasgoodfrequencyresolutionandreduced
spectralleakage.
Youshouldcomparetheperformanceofdifferentwindowfunctionstofindthebestonefortheapplication.

4.AdditionalInstrumentationResources

MultifunctioninstrumentsIntegratedbenchtopinstrumentsintoasingle,fixedfunctiondevice.
(http://www.ni.com/virtualbench/whatis/)
Learnaboutanallinoneinstrumentthatcombinesamixedsignaloscilloscope,afunctiongenerator,adigitalmultimeter,a
programmableDCpowersupply,anddigitalI/OintoonedeviceandworkswithyourPCoriPadforefficientcircuitdesign
debuggingandvalidation.

ExploreOscilloscopesBuiltforTest(http://www.ni.com/whitepaper/51981/en/)
Oscilloscopesareessentialinstrumentsatthecoreofavarietyofapplications,makingthemanecessityforautomatedtest
systems.Consideramodularsolutionifyourapplicationrequiresmeasuring,analyzing,orprocessingdatademandsfast
throughputorrequiresasmallformfactorwithminimalpowerconsumption.

Forthecompletelistoftutorials,returntotheInstrumentFundamentalsmainpage(http://www.ni.com/tutorial/3214/en/).

http://www.ni.com/whitepaper/4844/en/

10/10

You might also like