0
$\begingroup$

Windowing functions are explained on Wikipedia and they include plots of the Fourier transform for several windowing functions. For the triangle window they provide
enter image description here 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?

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Hilmar Nov 28 '16 at 21:52
  • 1
    $\begingroup$ Or check here. $\endgroup$ – Gilles Nov 28 '16 at 22:00
2
$\begingroup$

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);

triangular

$\endgroup$
  • $\begingroup$ @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? $\endgroup$ – Ted Ersek Nov 29 '16 at 0:21
  • 1
    $\begingroup$ 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); $\endgroup$ – Maximilian Matthé Nov 29 '16 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.