Fourier Series does not match the original function

Have defined a periodic function in a recursive way. When doing Fourier series I get a function with different period. Can someone spot the mistake?

enter code here
ClearAll;
T=20;
f[x_] := Which[x >= T/2, f[x - T],
x <= -T/2, f[x + T],
-T < x < T, Exp[-x^2]];
Plot[f[x],{x,-30,30},PlotRange->All]
FourierCosSeries[f[x],x,6]
(*FourierSeries[f[x],x,1]*)
Plot[%,{x,-30,30}]

It is because of the period. Fourier series assumes, as default, that period is $$2\pi$$

So to tell it the period is $$T=20$$, you can use FourierParameters otherwise it has no idea.

ClearAll;
T = 20;
f[x_] := Which[x >= T/2, f[x - T], x <= -T/2, f[x + T], -T < x < T,
Exp[-x^2]];
Plot[f[x], {x, -30, 30}, PlotRange -> All, Exclusions -> None] sol = FourierSeries[f[x], x, 10, FourierParameters -> {1, 2 Pi/T}];
Plot[Evaluate[sol], {x, -30, 30}, PlotRange -> All,
Exclusions -> None, PlotStyle -> Red] And now it matches. Same for

sol = FourierCosSeries[f[x], x, 10, FourierParameters -> {1, 2 Pi/T}];
Plot[Evaluate[sol], {x, -30, 30}, PlotRange -> All,
Exclusions -> None, PlotStyle -> Red] 