Diskretna Fourierova transformacija

Trigonometrijski interpolacijski polinom p

fun[xx_] := 1 - Abs[xx - 1]
slfun = 
        Plot[fun[xx], {xx, 0, 2}, 
          DisplayFunction -> Identity];
L = 2; n = 6; h = L/n;
x = Table[(j - 1) h, {j, n}]; 
    f = fun[x];
Print[
      MatrixForm[
        Transpose[
          Table[{x[[i]], f[[i]]} // N, {i, 
              n}]]]]
V = 
        Table[Exp[2 (i - 1) (j - 1) Pi I/n], {i, n}, {j, 
            n}];

      
d = Conjugate[V] . f/n;
p[xx_] := 
        Sum[d[[k]] Exp[2 (k - 1) Pi I xx/L], {k, 
            n}];
slp = 
        Plot[{Re[p[xx]],  Im[p[xx]]}, {xx, 0, L}, 
          DisplayFunction -> Identity];
sl6 = 
        Show[slfun, slp, 
          DisplayFunction -> $DisplayFunction];

Trigonometrijski interpolacijski polinom r

fun[xx_] := 
      1 - Abs[xx - 1]
slfun = 
        Plot[fun[xx], {xx, 0, 2}, 
          DisplayFunction -> Identity];
L = 2;n = 6;h = L/n;
x = Table[(j - 1) h, {j, n}]; 
    f = fun[x];
Print[
      MatrixForm[
        Transpose[
          Table[{x[[i]], f[[i]]} // N, {i, 
              n}]]]]
f = 
        Table[(-1)^(i - 1) f[[i]], {i, 
            n}];
V = 
          Table[Exp[2 (i - 1) (j - 1) Pi I/n], {i, n}, {j, n}];
  
d = 
        Conjugate[V] . f/n;
r[xx_] := 
        Sum[d[[k + n/2 + 1]] Exp[2  k Pi I xx/L], {k, -n/2, 
            n/2 - 1}];
sl1 = 
        Plot[Re[r[xx]], {xx, 0, L}, 
          DisplayFunction -> 
            Identity];
sl2 = 
        Plot[Im[r[xx]], {xx, 0, L}, 
          DisplayFunction -> Identity];
sl6=slrr=Show[slfun, sl1, DisplayFunction -> Identity(*,PlotLabel->"Re[r(x)]    n=10"*)];
slri = 
        Show[slfun, sl2, PlotRange -> {- .1, 1}, 
          DisplayFunction -> Identity, 
          PlotLabel -> "Im[r(x)]    n=6"];
Show[GraphicsArray[{slrr, slri}], 
        DisplayFunction -> $DisplayFunction];