MathGroup Archive 2002

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

Search the Archive

Re: Fourier coefficients

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32947] Re: [mg32935] Fourier coefficients
  • From: BobHanlon at aol.com
  • Date: Thu, 21 Feb 2002 02:06:59 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2/20/02 2:31:21 AM, phil at icu.strath.ac.uk writes:

>I am trying to do something really "simple".  I want to Plot the Fourier
>
>coefficients as vertical lines.  The line height should be proportional
>
>to the magnitude of its respective coefficient.  I just can't seem to 
>get it though.  Any ideas?
>

Needs["Calculus`FourierTransform`"];
Needs["Graphics`Colors`"];

FourierTrigSeries[t, t, 5]

Sin[2*Pi*t]/Pi - Sin[4*Pi*t]/(2*Pi) + Sin[6*Pi*t]/(3*Pi) -
 
  Sin[8*Pi*t]/(4*Pi) + Sin[10*Pi*t]/(5*Pi)

m=8;
coef = Table[FourierSinCoefficient[t, t, n], {n,m}]

{1/Pi, -(1/(2*Pi)), 1/(3*Pi), -(1/(4*Pi)), 1/(5*Pi),
 
  -(1/(6*Pi)), 1/(7*Pi), -(1/(8*Pi))}

Plot[{1/(n*Pi),-1/(n*Pi), Sin[(2n-1)*Pi/2]/(n*Pi)},
    {n,1,m},
 
    PlotStyle->{
        {Green,AbsoluteDashing[{2,5}]},
        {Green,AbsoluteDashing[{2,5}]},
        {Blue,AbsoluteDashing[{5,5,2,5}]}},
 
    Frame -> True,
    Epilog->{Red,
        Table[
          Line[{{n,0},{n,coef[[n]]}}],
          {n,m}]}];


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: complexity of AppendTo
  • Next by Date: Re: coloured contour plots
  • Previous by thread: Re: Fourier coefficients
  • Next by thread: Re: Fourier coefficients