Calculating Fourier Coefficients By Excel

210 Views Asked by At

I'm trying to use Excel to calculate Fourier coefficients. But I'm confused on which method should be used to used to approximate $$\int f(x)\cos(x)dx$$ and $$\int f(x)\sin(x)dx $$.

$1.\quad$ trapezoid $\cos(x)$ & trapezoid $\sin(x)$

$2.\quad$ trapezoid definite integral $\cos(x)dx$ & trapezoid definite integral $\sin(x)dx$

I found an example excel sheet (https://quickfield.com/harmonics_analysis_excel.htm) that seems to takes the definite integral of the cosine & sine term.

Is this a more accurate method than averaging $f(x)\cos(x)$ and $f(x)\sin(x)$ normally?