I fitted the function: f(t)=A_o+A_1 cos(wt)+B_1 sin(wt) to the following periodic discrete signal:
t=0:0.15:1.5;
y=[2.200 1.595 1.031 0.722 0.786 1.200 1.805 2.369 2.678 2.614 2.200];
Where w=2*pi / T, and T=1.5 seconds.
It happens that the fitted curve presents a phase shift with respect to the data. I consulted books on this topic and I found that I should exclude the last point of the series in order to get the right answer,...
I suspect that this matter is related with the exclusion of the last point in the calculation of the DFT, but do not find a mathematical argument that can prove this statement.
I would appreciate any mathematical explanation on this matter.