This function is written to calculate the cofficients of fourier series.
In the function arguments, fs(x,T0,n,type), note that :
x : the fuction that you might to calculate it's fourier series,
*.note that you should enter one period of the periodic function(x).
**. Be careful! You should enter one period of signal in range [-T/2,T/2]
,not [0 T] or other ranges.
T0 : Period of function.
n : Number of cofficients must be calculated.
type : type 0 to calculate the magnitude and phase of cofficients.
type 1 to calculate the real and imaginary part of cofficients.