MathGroup Archive 2012

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

Search the Archive

Re: Fourier DFT scaling problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126609] Re: Fourier DFT scaling problem
  • From: W Craig Carter <ccarter at mit.edu>
  • Date: Thu, 24 May 2012 03:32:22 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jpflom$ktd$1@smc.vnet.net> <201205230730.DAA05002@smc.vnet.net>

Hello Kevin,
The snippet you provided was useful and timely for me.  Would you happen 
to have something similar for spectral derivatives using Fourier[], 
FourierDCT[], and FourierDST[]?
Thanks in any case,

Craig Carter




On May 23, 2012, at Wed, May 23, 12 ---3:30 AM, Kevin J. McCann wrote:

> Psi[x_] := \[Pi]^(-1/4) E^(-(x^2/2))
>
> \[ScriptCapitalN] = 2^8;
> L = 32.0;
> \[CapitalDelta]x = L/\[ScriptCapitalN];
> x = -16 + Table[i, {i, 0, \[ScriptCapitalN] - 1}]*\[CapitalDelta]x;
> \[CapitalDelta]k = 1/L;
>
> f = Psi[x];
> k = Table[n \[CapitalDelta]k, {n, 0, \[ScriptCapitalN] - 1}];
>
> F = \[CapitalDelta]x Fourier[f, FourierParameters -> {1, -1}];
> ListPlot[Transpose[{k, Abs[F]^2}], PlotRange -> All, Joined -> True]
> (* This part rotates the k-spectrum so it "looks right" *)
> krot = Table[
>    n \[CapitalDelta]k, {n, -(\[ScriptCapitalN]/2), \[ScriptCapitalN]/
>      2 - 1}];
> Frot = RotateRight[F, \[ScriptCapitalN]/2];
> ListPlot[Transpose[{krot, Abs[Frot]^2}], PlotRange -> All,
>  Joined -> True]
> (* Check that Parseval is right *)
> {Total[Abs[f]^2] \[CapitalDelta]x, Total[Abs[F]^2] \[CapitalDelta]k}




  • Prev by Date: Re: Question about ColorFunction
  • Next by Date: Re: Question about ColorFunction
  • Previous by thread: Re: Fourier DFT scaling problem
  • Next by thread: Re: Fourier DFT scaling problem