help-octave
[Top][All Lists]

## Approximation with a Fourier-Series

 From: stn021 Subject: Approximation with a Fourier-Series Date: Wed, 31 Jan 2018 17:25:10 +0100

```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 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

```

reply via email to