<< Graphics`Graphics`
<< Calculus`FourierTransform`

ex. 5.16  Discrete FFT  = DFFT approximation of periodic wave   p.85

T = 1
wt = 2 + 20 (t - Round[t])
zu1 = 
      Plot[wt, {t, 0, T}, AspectRatio ->  0.3, 
        GridLines ->  Automatic]

n = 16; 
    te = T (1 - 1/n); Δt = T/n
dat = 
        Table[wt, {t, 0, te, Δt}];
data = 
        Table[{t, wt}, {t, 0, 
            te, Δt}];
zu2 = 
      ListPlot[data, PlotStyle -> {Hue[0.9], PointSize[0.02]}, 
        DisplayFunction ->  Identity]
Show[zu1, zu2]

xlabel = Table[i, {i, 0, n - 1}];
dft = 2 Fourier[dat]/Sqrt[n];
dft[[1]] = dft[[1]]/2;
BarChart[Abs[dft], PlotRange ->  {{1, n}, {0, 8}}, 
      AspectRatio ->  0.5, GridLines ->  Automatic, 
      BarLabels ->  xlabel]

BarChart[Abs[dft], PlotRange ->  {{1, n/2 + 1}, {0, 8}}, 
      AspectRatio ->  0.5, GridLines ->  Automatic, 
      BarLabels ->  xlabel]

ft = 
        dft[[1]] + 
          Sum[Re[Conjugate[dft[[k + 1]]] Exp[I 2 Pi k t/T]], {k, 1, 
              n - 1}];
Show[zu1, Plot[ft, {t, 0, T}]]