MathGroup Archive 2007

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

Search the Archive

Re: plotting fourier amplitude versus frequency

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80214] Re: [mg80198] plotting fourier amplitude versus frequency
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 15 Aug 2007 04:10:33 -0400 (EDT)
  • References: <200708141115.HAA10101@smc.vnet.net>

On Aug 14, 2007, at 7:15 AM, Indrani Sinha wrote:

> Hi,
>
> I am trying to extract frequencies from a data set of
> length versus time.
>
> Dataset:
> time   bondlength
>
> I am using the following script:
> data = ReadList["length.dat",{Number,Number}];
> plain=N[Transpose[data][[2]]];
> f=Fourier[plain];
> s=OpenWrite["fourier_tmp.dat"];
> WriteString[s,"#"];
> Do[Write[s,Abs[f[[i]]]],{i,1,Length[f]}];
> Close[s];
> !sed 's/*\^/e/g' fourier_tmp.dat > cfourier.dat
> Quit
>
> This gives me an output file cfourier.dat with the
> fourier amplitude values, but how do I get the
> corresponding frequencies?

The times are the first elements of data, presumably your data is  
sampled equispaced or the fourier analysis would make no sense so you  
can get the period as:

period = data[[2,1]] - data[[1,1]]

Your frequencies are then

0..(Length[f]/2-1) / (Length[f] period)

for the first Length[f] / 2 points and

-1/(2 period)..-1/(Length[f] period)

for the last Length[f]/2 poiints.

>
> Also the first line in the output has a number; what
> does that signify?

I have no idea, your script outputs a # on the first line of the  
output file with the command WriteString[s,"#"].

Regards,

Ssezi


  • Prev by Date: Re: question
  • Next by Date: Re: Reproducible kernel crash
  • Previous by thread: plotting fourier amplitude versus frequency
  • Next by thread: Re: plotting fourier amplitude versus frequency