File:Window function (comparsion).png
Page contents not supported in other languages.
Size of this preview: 800 × 588 pixels. Other resolutions: 320 × 235 pixels | 640 × 470 pixels | 988 × 726 pixels.
Original file (988 × 726 pixels, file size: 54 KB, MIME type: image/png)
This is a file from the Wikimedia Commons. Information from its description page there is shown below. Commons is a freely licensed media file repository. You can help. |
Contents
Summary
DescriptionWindow function (comparsion).png |
English: Comparison of different window functions |
||||||||
Date | |||||||||
Source | Own Work by user Marcel Müller | ||||||||
Author | Marcel Müller | ||||||||
Permission (Reusing this file) |
Marcel Müller at the English-language Wikipedia, the copyright holder of this work, hereby publishes it under the following license:
|
This graph image could be re-created using vector graphics as an SVG file. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with
{{vector version available|new image name}} .
It is recommended to name the SVG file “Window function (comparsion).svg”—then the template Vector version available (or Vva) does not need the new image name parameter. |
Image details and source code
The image is created with Mathematica 3.0 and some beautifications with CorelDraw 7.0. Due to the old versions no SVG export is available.
Init
<< Graphics`Graphics` << Graphics`Legend`
Parameters
Len = 4096; (* Window length *) Oversamp = 8; (* Oversampling *)
Helper functions
CreateWindow[winfn_] := Table[winfn[p/Len], {p,0,Len}] DoFFT[data_] := Chop@Take[ Fourier[RotateLeft[Join[data, Table[0, {Oversamp*(Length[data]-1)-Length[data]}]], (Length[data]-1)/2]], (Length[data]-1)*Oversamp/2+1] GetEnvelope[data_] := Block[ {min = 1, max, last = data[[1]]}, While[data[[min+1]] < last*1.001, last=data[[++min]]]; Map[ {#,data[[#]]}&, {Range[min], Select[Range[2, Length[data]-1], # > min && data[[#-1]] < data[[#]] > data[[#+1]]&]}, {2}] ] PlotWin[winfo_,opt___] := Block[ {fft = Abs@DoFFT@CreateWindow@winfo[[2]]}, ListPlot[ 20*Log[10, fft/fft[[1]]+1*^-12], GridLines->Automatic, PlotJoined->True, Frame->True, PlotRange->All, opt] ] PlotWin2[winfo_,opt___] := Block[ {fft = GetEnvelope@Abs@DoFFT@CreateWindow@winfo[[2]]}, {LogLinearListPlot[ {#[[1]]/Oversamp, 20*Log[10,#[[2]]/fft[[1,1,2]]+1*^-12]}& /@ fft[[1]], GridLines->Automatic, PlotJoined->True, Frame->True, PlotRange->All, opt], LogLinearListPlot[ {#[[1]]/Oversamp, 20*Log[10,#[[2]]/fft[[1,1,2]]+1*^-12]}& /@ fft[[2]], GridLines->Automatic, PlotJoined->True, Frame->True, PlotRange->All, opt]} ] Colors = Apply[ RGBColor, {{0,0,0}, {1,0,0}, {0,0,1}, {0,.7,0}, {.8,0,.8}, {0,.6,.6}, {.6,.6,0}, {.5,.5,.5}}, {1}]; Dashings = AbsoluteDashing/@(2{{} (*, {4,2}, {4,2,2,2}*)}); GetStyle[i_] := {Colors[[Mod[i-1,Length[Colors]]+1]], Dashings[[Mod[Quotient[i-1,Length[Colors]], Length[Dashings]]+1]]}
Window Functions
GaussWin[sigma_] = Exp[-.5 * ((2#-1)/sigma)^2]&; CosWin[a__] = Apply[Plus, {a} * Table[(-1)^p Cos[2 Pi p #], {p, 0, Length[{a}]-1}]]&; KaiserWin[alpha_] = BesselI[0, Pi alpha Sqrt[1 - (2#-1)^2]] / BesselI[0, Pi alpha]&; WinFN = { {"Recangular", 1&, 1.}, {"Gauss \[Sigma]=.4", GaussWin[.4], 1.45}, {"Hamming", CosWin[.53836,.46164], 1.37}, {"Hann", CosWin[.5,.5], 1.5}, {"Bartlett", 1-Abs[2#-1]&, 1.33}, {"Bartlett-Hann", .62-.48Abs[#-.5]-.38Cos[2Pi#]&, 1.46}, {"Blackman", CosWin[.42,.5,.08], 1.73}, {"Kaiser \[Alpha]=1", KaiserWin[1], 1.2}, {"Kaiser \[Alpha]=2", KaiserWin[2], 1.5}, {"Kaiser \[Alpha]=3", KaiserWin[3], 1.8}, {"Nutall", CosWin[.355768,.487396,.144232,.012604], 2.01}, {"Blackman-Harris", CosWin[.35875,.48829,.14128,.01168], 2.01}, {"Blackman-Nutall", CosWin[.3635819,.4891775,.1365995,.0106411], 1.98}, {"Flat top", CosWin[1,1.93,1.29,.388,.032], 3.77} };
Test Results
PlotWin[WinFN[[-1]]]; PlotWin2[WinFN[[-1]]]; ListPlot@CreateWindow[WinFN[[-1,2]]]; LogLogListPlot[DoFFT@CreateWindow[WinFN[[-1,2]]], PlotRange->All, PlotJoined->True, GridLines->Automatic]; DoFFT@CreateWindow[WinFN[[-1,2]]] GetEnvelope[Abs@DoFFT[CreateWindow[WinFN[[1,2]]]]]
Results
gr = Show[MapIndexed[ PlotWin2[#, DisplayFunction->Identity, PlotStyle->GetStyle[#2[[1]]]&, WinFN], DisplayFunction->$DisplayFunction, PlotRange->{All, {-145,5}}]; gr2 = ShowLegend[ gr, {MapIndexed[{Graphics[Append[GetStyle[#2[[1]]], Line[{{0,0},{1,0}}]]],#[[1]]}&, WinFN], LegendShadow->{0,0}, LegendPosition->{-.8,-.5}, LegendSize->{.4,.55}, LegendTextSpace->5}];
Licensing
Marcel Müller at the English-language Wikipedia, the copyright holder of this work, hereby publishes it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. Subject to disclaimers. | ||
Attribution: Marcel Müller at the English-language Wikipedia | ||
| ||
This licensing tag was added to this file as part of the GFDL licensing update.http://creativecommons.org/licenses/by-sa/3.0/CC BY-SA 3.0Creative Commons Attribution-Share Alike 3.0truetrue |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. Subject to disclaimers.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
Original upload log
The original description page was here. All following user names refer to en.wikipedia.
- 2007-01-19 20:25 Marcel Müller 988×726×??? (82239 bytes) Frequency response of the window functions. The double logarithmic plot shows the magnitude in dB over the normalized frequency. Besides the main lobe only the envelope of the frequency response is shown. This is more clearly and allows a quick comparsion
Items portrayed in this file
depicts
21 July 2006
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 21:53, 2 October 2016 | 988 × 726 (54 KB) | Cmdrjameson | Compressed with pngout. Reduced by 26kB (33% decrease). | |
01:42, 23 August 2008 | 988 × 726 (80 KB) | File Upload Bot (Magnus Manske) | {{BotMoveToCommons|en.wikipedia}} {{Information |Description={{en|Comparison of different window functions}} |Source=Transferred from [http://en.wikipedia.org en.wikipedia]; transferred to Commons by User:Sfan00_IMG using [http://tools.wikimedia.de/~ |
File usage
No pages on the English Wikipedia use this file (pages on other projects are not listed).
Global file usage
The following other wikis use this file:
- Usage on es.wikipedia.org
- Usage on it.wikipedia.org
- Usage on nl.wikipedia.org
Retrieved from "https://en.wikipedia.org/wiki/File:Window_function_(comparsion).png"