Fitting a periodic potential?

I will use this potential to calculate some physical properties

to do so, I need to find a fitting function.
The series expansion

a0+Cos[x] a1+Cos[x]^2 a2+Cos[x]^3 a3+Cos[x]^4 a4+Cos[x]^5 a5+b0+Sin[x] b1+Sin[x]^2 b2+Sin[x]^3 b3+Sin[x]^4 b4+Sin[x]^5 b5

truncated at the 5th degree gives the following fitting

Which could serve the purpose except that periodicity disappears at the beginning of the curve: the well becomes deeper than what it should be. How can I enforce periodicity on the fitting function?

As an alternative to a Fourier expansion, the curve you have drawn can be well represented by 6 connected linear segments, repeated periodically.

In case you do not need an analytic expression, then

Interpolation[(* your data *), PeriodicInterpolation -> True]

might be helpful.

I actually need to use the Fourier series because I will repeat the process on much smoother potentials. I have tried Fourier series to fit another more wiggling potential and the same problem occurred; the first well became deeper.

Interpolation works fantastically but I need the fitting function itself because I need to calculate Hamiltonian matrix elements. After using Interpolation it is possible to perform integration and differentiation on the InterpolatingFunction, but it is not possible to do that when combining the InterpolatingFunction with other expressions.