help-octave
[Top][All Lists]

## Re: Problem with fourier transform

 From: Glenn Golden Subject: Re: Problem with fourier transform Date: Wed, 05 May 2004 13:55:03 -0600

```"Antonio L." writes:
> > I'm not sure I understand why you don't want to use the inverse
> > transform rather than writing out the Fourier series summation
> > explicitly.  Seems like you could get what you want by using ifft()
> > like this:
>
> The reason is because I pretend to find a way of obtaining a
> smooth continuous function out of a discrete one. Thus you could
> think in the continuous fourier transform of the fourier transform
> of the discrete periodic original one. I don't know if I've explained
> myselft.
>

Umm, but you originally said you wanted to evaluate the time series at
integer values:

"Antonio L." wrote:
> # given an integer value of x like -2,-1,0,1,2,3,4,5,6,....
> x = <integer value>;
>
> # we would get y(x) with this expression
> y_x = sum(z.*exp((-2:2)'*i*pi*x/rows(z)))

and for this, ifft() is all you need.

If what you really want to do is to _interpolate_ the periodic extension
of the original time series, then the expression I gave at the end of
my previous response will do the trick, except that you can no longer
take the real part and get a [directly] meaningful answer, except at
integer values of x.

I.e., for arbitrary time index x (continuous variable), compute

xmod = mod(x, y_period)

and then apply this in

(1/N) * sum(z .* exp(-J * 2 * pi * xmod * (0:N-1) / N))

which is just the continuous-time Fourier series representation of the
periodic extension of the original time series, evaluated at time 'xmod'.
If xmod is an integer, then this sample will concur with the appropriate
sample of the [periodic extension of] the original time series.  If x is
not an integer, then in general, the interpolated sample will be complex.

I'm not sure what you're using this for, but be aware that there are
many ways to perform interpolation, depending on what error criteria
one is interested in, and this is a very simplistic approach. The result
will be meaningful only if the original time series genuinely is one period
of an infinte-length periodic function, which is to say, a time series
that can be exactly represented by a finite set of Fourier coefficients.
If that is not the case, then the result will be only an approximation --
possibly an extremely poor one -- to the desired time series.

Glenn

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```