X= {0, 0.5, 1, 1.5, 2};
Y = {0, 7, 1, 1, 2};

len = Length[X];

Plot1=ListPlot[Table[{X[[i]], Y[[i]]}, {i,1, len}], PlotRange -> {{-1, 7}, {0, 8}},PlotMarkers ->■];

trigPoly[x_]=(Subscript[u, 0]) + Sum[(Subscript[u, i])Cos[x*i] + (Subscript[y, i])Sin[x*i], {i, 1, 2}]

T=2Pi/2.5* X;

equations = Table[trigPoly[T[[i]]] == Y[[i]], {i, 1, len}];

coefficients = NSolve[
equations]

f=trigPoly[x]/.coefficients;
Plot2=Plot[f,{x,0,6}];
Show[{Plot1,Plot2}, PlotRange -> {{-1, 6}, {-1, 8}} ]