MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Valerie
on 8 Apr 2011

I need to find the Fourier series coefficients of an arbitrary x,y data set over an arbitrary number of series terms using a general linear least squares technique.

the fourier series represents a function f(x) as

f(x)=a_0/2 + sum(a_n*cos(n*x) + b_n*sin(n*x))

any help would be great!

*No products are associated with this question.*

## 2 Comments

## Matt Tearle (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/5055#comment_10308

Is this a homework problem where your answer has to be in a certain prescribed formulation, or are you trying to do an actual fitting problem?

## Matt Tearle (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/5055#comment_10309

(Just so I know which answer to give...!)