How to decompose a 2d shape into sin and cosin modes?

178 Views Asked by At

Assume that you have a circle with radius $r_0$, then you keep adding cosine modes as below:

$r=r_0+a_1\cos(1\theta)+a_2\cos(2\theta)+a_3\cos(3\theta)+a_4\cos(4\theta)+~...$

if you plot this as below by matlab:

r0=1;
a1=0.2;
a2=0.2;
a3=0.2;
a4=0.2;
th=0:0.01:2*pi;
r=r0+a1cos(th)+a2cos(2*th)+a3cos(3*th)+a4cos(4*th);
x=r*cos(th);
y=r*sin(th);
plot(x,y);

You will see that you can get different shapes by changing the number of modes (i.e. here n=4) or coefficients (i.e. $a_i$) and even omitting some modes (i.e. $a_k=0$) you will get different shapes.

My question is that how can you decompose for instance an oval or a square in cosine modes, and find their coefficients (somehow in the way of fourier decomposition), is it ever possible?

But I think making any shape would be possible by my method mentioned above, but I am interested to know how I can come from an arbitrary shape to its corresponding cosine modes.