# The Fourier transform of a triangular window function

Windowing functions are explained on Wikipedia and they include plots of the Fourier transform for several windowing functions. For the triangle window they provide
The above Fourier transform plot has a horizontal axis that goes from -40 bins to +40 bins, so this seems to be a discrete Fourier transform. However, I don't get a plot like that when I apply an FFT to 80 samples of a triangular window. I am further confused in that the graphic of the Fourier transform looks like a continuous plot rather than 80 discrete samples.

My questions are: How does one create the plot for the Fourier transform of a triangular window? Is the plot for a continuous Fourier transform or discrete Fourier transform?

• This plot was probably done with lots of zero padding. Do an FFT over 16k points or so. This is equivalent to dense interpolation in the frequency domain. – Hilmar Nov 28 '16 at 21:52
• Or check here. – Gilles Nov 28 '16 at 22:00

Not the perfect fit, but a quick-and-dirty base to play on:

%nBin = 81;
nBin = 2049;

y=(20*log(fftshift(abs(fft(triang(81),nBin)))))';
x = linspace(-40,40,length(y));
basey = min(0,min(y));
ShadingColor = [0 0 1];
h = fill([x x(end) x(1)], [y basey basey], ShadingColor);
set(h, 'EdgeColor','none', 'FaceAlpha', 0.5);


• @Luarent Duval, The frequency plot at Wikipedia has local max as low as about -73 dB, and as high as 0 dB. The frequency plot you posted has local max as low as about -75 dB and as high as about +75 dB. Could the Wikipedia plot require a different interpretation? – Ted Ersek Nov 29 '16 at 0:21
• The picture in wikipedia somehow shows the amplitude in dB, not its power in dB. I would agree to Laurent's interpretation, however, in case you want to recreate the wikipedia plot, do this: y=(10*log(fftshift(abs(fft(triang(81),nBin)))))'; y = y - max(y); – Maximilian Matthé Nov 29 '16 at 5:12