MathGroup Archive 2008

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

Search the Archive

Re: Fourier Series Expansions and it's Coefficients question revised

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85226] Re: Fourier Series Expansions and it's Coefficients question revised
  • From: Peter Pein <petsie at dordos.net>
  • Date: Sat, 2 Feb 2008 23:30:50 -0500 (EST)
  • References: <fo1ad4$ga3$1@smc.vnet.net>

Šerých Jakub schrieb:
> I think, that one solution could be to find interpolating polynomial first,
> 
> InterpolatingPolynomial[{14, 18.7, 9, 4.1, 6.7, 6, 6.3, 8.4, 4, 2.9},x]
> 
> and than create Fourier Series from it. But I'm Mathematica newbie, so may
> be, there is some much more elegant solution.
> 
> Jakub 
> 

I would recommend to take one period (or at least a few points) of data before
the range 0..10 and one following this range, when using
InterpolatingPolynomial. Compare the  plots of your suggestion and the one of

data = Transpose[{Range[-10, 19], (Join[#1, #1, #1] & )[{14, 187/10, 9, 41/10,
67/10, 6, 63/10, 42/5, 4, 29/10}]}];
f[x_]=InterpolatingPolynomial[data,x];

then the usual way to get the fourier-params is

a[n_Integer] := (2/10)*NIntegrate[f[t]*Cos[(n*Pi*t)/5], {t, 0, 10}]
b[n_Integer] := (2/10)*NIntegrate[f[t]*Sin[(n*Pi*t)/5], {t, 0, 10}]
g[(t_)?NumericQ] = a[0]/2 + Sum[Evaluate[a[k]*Cos[(k*Pi*t)/5] +
b[k]*Sin[(k*Pi*t)/5]], {k, 1, 5}]


8.011501516064738 + 3.025521003292295*Cos[(Pi*t)/5] +
2.0158869647340403*Cos[(2*Pi*t)/5] +
  0.9918724144011796*Cos[(3*Pi*t)/5] - 0.01631857397076253*Cos[(4*Pi*t)/5] -
0.00923191072112789*Cos[Pi*t] +
  2.0375938524804407*Sin[(Pi*t)/5] + 4.022590777405677*Sin[(2*Pi*t)/5] +
2.9992713116104786*Sin[(3*Pi*t)/5] +
  0.04185501683827671*Sin[(4*Pi*t)/5] + 0.002552102419510827*Sin[Pi*t]

and the error integrates in this case to:

NIntegrate[Abs[f[t] - g[t]], {t, 0, 10}, Method -> GaussKronrod, GaussPoints
-> 11, MaxRecursion -> 11]

0.03266871759678233

Peter


  • Prev by Date: How edit a saved palette?
  • Next by Date: Re: Possible bug in ListAnimate[] or Manipulate[] v6.0
  • Previous by thread: Re: How edit a saved palette?
  • Next by thread: Re: Fourier Series Expansions and it's Coefficients question revised