MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with Fourier

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43981] Re: [mg43948] Problem with Fourier
  • From: David Withoff <withoff at wolfram.com>
  • Date: Thu, 16 Oct 2003 04:16:18 -0400 (EDT)
  • References: <200310150859.EAA26357@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> Hello all
>
> It seems to me that Mathematica 5.0 calculates somehow strange the
> discrete Fourier transform of a list of data, or i do not really
> understand the maths behind it.
> I would expect that the discrete Fourier transform of a finite object
> shows maxima in Fourier space at the integer reciprocal indices. But
> this does not seem to be the case in the following very simple examples.
> The first Table (data1) shows maxima in Fourier space at points 1 and
> 17, the second Table (data2) at points 3 and 20 and the third Table
> (data3) at points 4 and 39. How is this possible, shouldn't the maxima
> in Fourier space always be located at the first and last point.
> According to this, the maxima in Fourier space can be shifted by
> changing the resolution in direct space.
>
> thanks for hints
>
> miroslav kob
> as
>
> data1= Table[Sin[x], {x,0,0.5*¥ð,0.1}];
> data2=Table[Sin[x], {x,0,10,0.5}];
> data3=Table[Sin[x], {x,0,20,0.5}];
>
> ListPlot[Abs[Fourier[data1]], PlotStyle -> PointSize[0.02],
>       AxesOrigin -> {1, 0}, PlotRange -> All];
> ListPlot[Abs[Fourier[data2]], PlotStyle -> PointSize[0.02],
>       AxesOrigin -> {1, 0}, PlotRange -> All];
> ListPlot[Abs[Fourier[data3]], PlotStyle -> PointSize[0.02],
>       AxesOrigin -> {1, 0}, PlotRange -> All];

You may be able to see the essential effects more easily
by looking at examples where the period of the signal is
commensurate with the length of the sample.  The position
of the peaks is determined by the number of periods in the
sample.  For example:

s1 = Table[Sin[2 Pi x], {x, 0.1, 10, 0.5}];
ListPlot[Abs[Fourier[s1]],
    PlotRange -> {{0, 30}, All}, PlotJoined -> True]

with 10 periods in the sample shows a peak at position 11
(the non-constant terms start at position 2) and

s2 = Table[Sin[2 Pi x], {x, 0.1, 20, 0.5}];
ListPlot[Abs[Fourier[s2]],
    PlotRange -> {{0, 30}, All}, PlotJoined -> True]

with 20 periods in the sample shows a peak at position 21.
Changing the resolution does not change the position of
this peak.  For example,

s1 = Table[Sin[2 Pi x], {x, 0.1, 10, 0.5}];
ListPlot[Abs[Fourier[s1]],
    PlotRange -> {{0, 30}, All}, PlotJoined -> True]

and

s3 = Table[Sin[2 Pi x], {x, 0.1, 10, 0.1}];
ListPlot[Abs[Fourier[s3]],
    PlotRange -> {{0, 30}, All}, PlotJoined -> True]

both show a peak at position 11, because both correspond
to 10 periods in the range of the sample, even though the
sample rates differ by a factor of 5.

The discrete Fourier transform is a fairly simple operation,
and is essentially the same in Mathematica as it is everywhere
else.  The only possible differences are in the choices of
arbitrary constants, but those differences do not affect
the positions of peaks.

Dave Withoff
Wolfram Research



  • Prev by Date: Errorbars using ListPlot and Epilog
  • Next by Date: Re: Concentric contours about the centroid, having the same length, and interior to an initial contour.
  • Previous by thread: Problem with Fourier
  • Next by thread: Re: Problem with Fourier