represents a Bartlett window function of x.
BartlettWindow
represents a Bartlett window function of x.
Details
- BartlettWindow, also known as the triangular window, is a window function typically used for antialiasing and resampling.
- Window functions are used in applications where data is processed in short segments and have a smoothing effect by gradually tapering data values to zero at the ends of each segment.
- BartlettWindow[x] is equal to
. - BartlettWindow automatically threads over lists.
Examples
open all close allBasic Examples (3)
Shape of a 1D Bartlett window:
Plot[BartlettWindow[x], {x, -1, 1}]Shape of a 2D Bartlett window:
Plot3D[BartlettWindow[x]BartlettWindow[y], {x, -1, 1}, {y, -1, 1}, PlotRange -> All]Extract the continuous function representing the Bartlett window:
FunctionExpand[BartlettWindow[x]]Scope (4)
BartlettWindow[0.1]Translated and dilated Bartlett window:
Plot[BartlettWindow[(x - 1) / 2], {x, -1, 3}]2D Bartlett window with a circular support:
Plot3D[BartlettWindow[Sqrt[x ^ 2 + y ^ 2]], {x, -1, 1}, {y, -1, 1}, PlotRange -> All]Discrete Bartlett window of length 15:
ListPlot[Array[BartlettWindow, 15, {-1 / 2, 1 / 2}], Filling -> Axis]Discrete 15×10 2D Bartlett window:
ListPointPlot3D[Array[BartlettWindow[#1] BartlettWindow[#2]&, {15, 10}, {{-1 / 2, 1 / 2}}], Filling -> Axis]Applications (4)
Create a moving average filter of length 11:
h = ConstantArray[1 / 11, 11]Taper the filter using a Bartlett window:
w = Array[BartlettWindow, Length[h], {-1 / 2, 1 / 2}];
fir = w h;fir / Total[fir]Log-magnitude plot of the power spectra of the two filters:
Plot[Evaluate[20Log10[Abs@ListFourierSequenceTransform[#, ω]]& /@ {h, %}], {ω, 0, Pi}, GridLines -> Automatic]Filter a white noise signal using the Bartlett window method:
a = AudioGenerator["White", 1, SampleRate -> 8000];
Periodogram[{a, LowpassFilter[a, 8000 π / 3, 21, BartlettWindow]}]Use a window specification to calculate sample PowerSpectralDensity:
proc = ARMAProcess[1, {.5}, {.3}, 1];
data = RandomFunction[proc, {50}];spec = PowerSpectralDensity[data, w, BartlettWindow];Compare to spectral density calculated without a windowing function:
sd = PowerSpectralDensity[data, w];sd === specThe plot shows that window smooths the spectral density:
Plot[{sd, spec}, {w, -π, π}, PlotRange -> All, PlotLegends -> {"no window", "with window"}]Compare to the theoretical spectral density of the process:
Plot[{spec, Evaluate@PowerSpectralDensity[proc, w]}, {w, -π, π}, PlotLegends -> {"data", "process"}]Use a window specification for time series estimation:
data = RandomFunction[ARMAProcess[1, {.3}, {.4}, 1], {300}];Specify window for spectral estimator:
EstimatedProcess[data, ARMAProcess[1, 1], ProcessEstimator -> {"SpectralEstimator", "Window" -> BartlettWindow}]Properties & Relations (6)
BartlettWindow is equivalent to a compressed UnitTriangle:
PiecewiseExpand[BartlettWindow[x]] === PiecewiseExpand[UnitTriangle[2x]]The area under the Bartlett window:
area = Integrate[BartlettWindow[x], {x, -∞, ∞}]Normalize to create a window with unit area:
Plot[{BartlettWindow[x], BartlettWindow[x] / area}, {x, -1, 1}]Fourier transform of the Bartlett window:
f = FourierTransform[BartlettWindow[x], x, w]Power spectrum of the Bartlett window:
LogLinearPlot[20 Log[10, Abs[f]], {w, .1, 100}]Discrete Bartlett window of length 15:
Array[BartlettWindow, 15, {-0.5, 0.5}]Normalize so the coefficients add up to 1:
% / Total[%]Discrete-time Fourier transform of a normalized discrete Bartlett window of length 15:
(win = Array[BartlettWindow, 15, {-0.5, 0.5}];
f = ListFourierSequenceTransform[win / Total[win], ω])Plot[Abs@f, {ω, 0, π}, PlotRange -> All]Power spectra of the Bartlett and rectangular window sequences:
tab = Table[(h = Array[win, 15, {-0.5, 0.5}];
20Log10[Abs@ListFourierSequenceTransform[h / Total[h], ω]]), {win, {BartlettWindow, DirichletWindow}}];Plot[tab, {ω, 0, π}, PlotRange -> {5, -80}, PlotLegends -> {BartlettWindow, DirichletWindow}]Related Guides
History
Text
Wolfram Research (2012), BartlettWindow, Wolfram Language function, https://reference.wolfram.com/language/ref/BartlettWindow.html.
CMS
Wolfram Language. 2012. "BartlettWindow." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BartlettWindow.html.
APA
Wolfram Language. (2012). BartlettWindow. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BartlettWindow.html
BibTeX
@misc{reference.wolfram_2026_bartlettwindow, author="Wolfram Research", title="{BartlettWindow}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/BartlettWindow.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_bartlettwindow, organization={Wolfram Research}, title={BartlettWindow}, year={2012}, url={https://reference.wolfram.com/language/ref/BartlettWindow.html}, note=[Accessed: 13-June-2026]}