Hey HSeries.

You will have to decide what kind of function you wish to "fit" to and then construct an orthogonal set of basis functions to project to.

The simplest would be a polynomial of degree n but you could use another function if you wanted to.