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

• To: mathgroup at smc.vnet.net
• Subject: [mg85322] Re: [mg85293] RE: [mg85198] Fourier Series Expansions and it's Coefficients question revised tia
• From: DrMajorBob <drmajorbob at bigfoot.com>
• Date: Wed, 6 Feb 2008 01:24:16 -0500 (EST)
• References: <200802010720.CAA10016@smc.vnet.net> <13683770.1202246769990.JavaMail.root@m08>
• Reply-to: drmajorbob at bigfoot.com

```Below I show a way to output a fit function and eliminate the error
messages.

I used a couple of tricks in NIntegrate; I'm not sure both are needed.

Needs["FourierSeries`"]
d = {14, 18.7, 9, 4.1, 6.7, 6, 6.3, 8.4, 4, 2.9, 14};
data = Thread[{Range@Length@d, d}];
f = Interpolation[data, PeriodicInterpolation -> True];

MapIndexed[{First@#2, #1} &, d] ==
MapIndexed[Reverse@Flatten@List[##] &, d] == data

True

nintegrate[expr_, {v_, lo_, hi_}] :=
With[{rnge = Flatten@{v, Range[lo, hi]}},
NIntegrate[expr, rnge, Method -> "LocalAdaptive"]]

s[x_] = Chop[
FourierTrigSeries[f[x], x, 5, FourierParameters -> {-1, 1/10}] /.
Integrate -> nintegrate]

8.01+ 1.24467 Cos[(\[Pi] x)/5] - 3.09947 Cos[(2 \[Pi] x)/5] -
2.72951 Cos[(3 \[Pi] x)/5] - 0.00418324 Cos[(4 \[Pi] x)/5] +
0.00868891 Cos[\[Pi] x] + 3.41712 Sin[(\[Pi] x)/5] +
3.05416 Sin[(2 \[Pi] x)/5] + 0.0107795 Sin[(3 \[Pi] x)/5] -
0.0314359 Sin[(4 \[Pi] x)/5]

Show[Plot[s[x], {x, -10, 20}], Graphics@Point@data]

Bobby

On Tue, 05 Feb 2008 05:10:24 -0600, Jaccard Florian
<Florian.Jaccard at he-arc.ch> wrote:

> Hello!
>
> I looked at the answers you already got and tried them.
> InterpolatingPolynomial is a good idea, but the difference with what you
> expect it a bit too big.
> The answer Dana gave was very good, but I'm afraid TrigFit doesn't
> really exist anymore in version 6...
> So I would do it like this, hoping it looks like you wish:
>
> d = {14, 18.7, 9, 4.1, 6.7, 6, 6.3, 8.4, 4, 2.9, 14};
>
> f = Interpolation[d, PeriodicInterpolation -> True];
>
> << "FourierSeries`"
>
> s[x_] = N[FourierTrigSeries[f[x], x, 5, FourierParameters -> {-1,
> 1/10}]]
>
> At this point, you may have some alarming messages, but I believe it is
> not really problematical...
>
> As you can control, it looks not bad :
>
> Plot[s[x], {x, -10, 20}, Epilog -> {Point /@ data}]
>
> Best regards
>
> Florian Jaccard
>
>
> -----Message d'origine-----
> De=A0: ratullochjk at gmail.com [mailto:ratullochjk at gmail.com]
> Envoy=E9=A0: vendredi, 1. f=E9vrier 2008 08:20
> =C0=A0: mathgroup at smc.vnet.net
> Objet=A0: [mg85198] Fourier Series Expansions and it's Coefficients =
=
> question revised tia
>
> Fourier Series Expansions and it's Coefficients question revised
>
> Greetings
>
> I've worked through a Fourier Series Expansion and it's Coefficients a=
nd
> have a better gasp at a how to explain my question.  If I'm giving a
> repeating wave at (T) period of 10 seconds with amplitudes
> At 14, 18.7,9,4.1,6.7,6,6.3,8.4,4,2.9 how can I find the Fourier Serie=
s
> Expansions in Trigonometric form using mathematica 6.  I've included a=
n
> example that I've worked through below
> http://demos.onewithall.net/discrete_fourier_expansion_coefficients.jp=
g
>
> I've been through mathematica site and they have examples of
> Fourier Series but the examples they have are examples of equations th=
ey
> give you.  I'm looking for an example where the equation isn't known a=
nd
> all you're given is the waveform, repeating period in seconds and the
> amplitudes. Like in my example.
> http://demos.onewithall.net/discrete_fourier_expansion_coefficients.jp=
g
>
> Does an example exist? If not what are the steps needed in mathematica=
6  =

> =
> to
> accomplish this.
>
> Tia simple
>
>
>

-- =

DrMajorBob at bigfoot.com

```

• Prev by Date: Re: Maximum likelihood and Mathematica
• Next by Date: Re: Quantum Commutator
• Previous by thread: RE: Fourier Series Expansions and it's Coefficients question revised tia
• Next by thread: RE: Fourier Series Expansions and it's Coefficients question revised tia