I'm struggling to get my head around a problem with fourier series in matlab and so far my attempts have been in vein.

The problem: I'm looking at an image shape classification technique which first finds the center of an image and then maps the radius from the center to image edge over 64 evenly spaced angles (range 0-2pi radians), so that we're looking at the image in polar coordinated relative to the center of the particle.

Using fourier analysis the radius as a function of angle (a) can then be represented as:

R(a) = A0/2 + sum(Ak*sin*k*a + Bk*cos*k*a) for the sum k=1:32

My question is how to go about calculating the fourier components A0, Ak and Bk given that my f(x) is not a function but data?

Apologies for the lack of elegance in writing out the formula, I need to learn how to use the formula function here :)

Thanks!