Approximation with a Fourier-Series

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Approximation with a Fourier-Series

stn021
Hello,

this is related to my previous question about numeric ways to reverse
a function.

I think if it were possible to find an approximation-function then
that would execute much faster than any least-square-based
optimization.

Candidates would be polynomes, possibly a 2-dimensional taylor-series
and a 2-dimensional fourier-series as my personal favourite.

For a function with one variable in a predefined range, for example
0..pi this is done like this:

y(x) = a0 + sum( a(i) * sin(x*i) + b(i) * cos(x*i) )  with i=1..N,
each i being a harmonic of the base-period.
The parameters a and b can then the found numerically.

My question here:

What would be the corresponding formula for a function with 2 variables?

y(x1,x2) = some sum of sin() and cos()

I have not found that anywhere.



I am aware of the octave-functions fft2() and ifft2().
So far it seems to me that I cannot apply these for 2 reasons:
1) I would first need a regular grid of dependent variables, which is
exactly what I do not have, due to the fact that I want to reverse an
existing function.
    This I could solve with a slow optimization-based algorithm
2) So far I don't see how to get ifft2() to calculate a single value
for a single pair of indepentent variables that are _between_ the
points of the original grid.
    Other functions like interp2() allow arbitrary input-values which
are then interpolated between the original data-points.
    fft2()/ifft2() does not seem to do this.
    Maybe I am missing something here


THX
Stefan


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Approximation with a Fourier-Series

Juan Pablo Carbajal-2
For multiple variables you will have to take the cartesian product of
you basis, e.g.

[1 sin(x) sin(x).*sin(y) sin(x).*cos(y) cos(x) cos(x).*sin(y) cos(x).*cos(y)]

You should use a basis that matches the features of the function you
want to approximate, e.i. periodic? smooth? saturating?


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------