Interpolation with FourierTrigSeries with mathematica 6 tia sal2

• To: mathgroup at smc.vnet.net
• Subject: [mg88424] Interpolation with FourierTrigSeries with mathematica 6 tia sal2
• From: ratullochjk2 at gmail.com
• Date: Mon, 5 May 2008 06:12:16 -0400 (EDT)

```Interpolation with FourierTrigSeries with mathematica 6 tia sal2

Greetings All

I'm trying to modify these mathematica 6 commands to test
some different data points. But I'm having some issues pop up and I
don't
know why.

This is the Code that I had help with that works great:

In[358] := data1 = {{0, 0}, {.5, -1}, {1, 0}, {2, 2}, {3,
0}, {4, -2.750000000}, {5, -4}, {6, -2.750000000}, {7, 0}, {8,
2.937500000}, {9, 5.500000000}, {10, 7.312500000}, {11, 8},
{12,7.312500000}, {13, 5.5}, {14, 2.937500000}, {15, 0}, {16,
-2.918367347}, {17, -5.346938775}, {18, -6.795918367},
{18.5, -7}, {19, -6.795918368}, {20, -5.346938776}, {21,-2.918367347},
{22, 0}, {23, 2.84}, {24, 4.72}, {24.5, 5}, {25, 4.72}, {26, 2.84},
{27, 0}};

f = Interpolation[data1, PeriodicInterpolation -> True];
<< "FourierSeries`"

s[x_] = N[
FourierTrigSeries[f[x], x, 31, FourierParameters -> {-1, 1/27}]]

My output is:

0.61887- 0.680232 Cos[0.232711 x] + 2.96293 Cos[0.465421 x] -
0.532024 Cos[0.698132 x] - 0.87105 Cos[0.930842 x] -
0.708467 Cos[1.16355 x] - 0.510603 Cos[1.39626 x] -
0.236222 Cos[1.62897 x] - 0.112403 Cos[1.86168 x] -
0.0682778 Cos[2.0944 x] - 0.0317201 Cos[2.32711 x] -
0.00399665 Cos[2.55982 x] + 0.0110171 Cos[2.79253 x] +
0.0150056 Cos[3.02524 x] + 0.0156793 Cos[3.25795 x] +
0.0122262 Cos[3.49066 x] + 0.00657111 Cos[3.72337 x] +
0.00432201 Cos[3.95608 x] + 0.00341808 Cos[4.18879 x] +
0.00370543 Cos[4.4215 x] + 0.00333083 Cos[4.65421 x] +
0.00210063 Cos[4.88692 x] + 0.00505182 Cos[5.11963 x] +
0.00866377 Cos[5.35234 x] + 0.0110508 Cos[5.58505 x] +
0.0103873 Cos[5.81776 x] + 0.00850073 Cos[6.05047 x] +
0.00811838 Cos[6.28319 x] + 0.00689916 Cos[6.5159 x] +
0.0069005 Cos[6.74861 x] + 0.00596679 Cos[6.98132 x] +
0.00358397 Cos[7.21403 x] + 2.25013 Sin[0.232711 x] -
4.51511 Sin[0.465421 x] + 0.380184 Sin[0.698132 x] +
0.461366 Sin[0.930842 x] + 0.0632479 Sin[1.16355 x] -
0.135095 Sin[1.39626 x] - 0.160692 Sin[1.62897 x] -
0.131694 Sin[1.86168 x] - 0.118779 Sin[2.0944 x] -
0.0966167 Sin[2.32711 x] - 0.0797548 Sin[2.55982 x] -
0.0599806 Sin[2.79253 x] - 0.0380326 Sin[3.02524 x] -
0.0247422 Sin[3.25795 x] - 0.0141664 Sin[3.49066 x] -
0.0078713 Sin[3.72337 x] - 0.0060369 Sin[3.95608 x] -
0.0062354 Sin[4.18879 x] - 0.00650479 Sin[4.4215 x] -
0.00560183 Sin[4.65421 x] - 0.00806245 Sin[4.88692 x] -
0.00982397 Sin[5.11963 x] - 0.00853789 Sin[5.35234 x] -
0.00582364 Sin[5.58505 x] - 0.00249366 Sin[5.81776 x] -
0.00125506 Sin[6.05047 x] - 0.0000310571 Sin[6.28319 x] +
0.000971067 Sin[6.5159 x] + 0.00160663 Sin[6.74861 x] +
0.00321022 Sin[6.98132 x] + 0.00388205 Sin[7.21403 x]

When I change different data points to the code example:

data2 = {{0, 0}, {1, 1}, {3, 0}, {7, -2}, {14, 1}, {17, 6}, {19, -2},
{25, -6}, {34, 6}, {41, 4}, {49, -6}, {56, -5}, {63, 4}, {69, 3}, {74,
-5}, {77, -3}, {86, 3}, {90, 7}, {95, -3}, {96, -8}, {103, 7}, {112,
9}, {120, -8}, {129, -9}, {138, 9}};

f = Interpolation[data2, PeriodicInterpolation -> True];
<< "FourierSeries`"

s[x_] = N[
FourierTrigSeries[f[x], x, 25, FourierParameters -> {-1, 1/138}]]

my partial output becomes :

0.00729927 NIntegrate[
Interpolation[{{0, 0}, {1, 1}, {3, 0}, {7, -2}, {14, 1}, {17,
6}, {19, -2}, {25, -6}, {34, 6}, {41,
4}, {49, -6}, {56, -5}, {63, 4}, {69,
3}, {74, -5}, {77, -3}, {86, 3}, {90,
7}, {95, -3}, {96, -8}, {103, 7}, {112,
9}, {120, -8}, {129, -9}, {138, 9}},
PeriodicInterpolation -> True][x], {x, -(137/2), 137/2}] +
0.0145985 Cos[0.0458627 x] NIntegrate..........................

does anyone know why this no longer outputs in the form of just sin
and cos?
(which I really want)

tia sal2

```

• Prev by Date: Re: can't translate 3D model to 0,0,0
• Next by Date: Re: Problem/bug with ends of thick lines in graphics
• Previous by thread: Re: Question about alignment in Grid and TableForm
• Next by thread: Re: Interpolation with FourierTrigSeries with mathematica 6 tia sal2