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

*To*: mathgroup at smc.vnet.net*Subject*: [mg85236] Re: Fourier Series Expansions and it's Coefficients question revised tia*From*: "Dana DeLouis" <dana.del at gmail.com>*Date*: Sat, 2 Feb 2008 23:36:06 -0500 (EST)

> At 14, 18.7,9,4.1,6.7,6,6.3,8.4,4,2.9 how can I find the Fourier Series > Expansions in Trigonometric form using mathematica 6. I believe you are looking for the function "TrigFit." Your period is 10. d = {14, 18.7, 9, 4.1, 6.7, 6, 6.3, 8.4, 4, 2.9}; If we do: equ = TrigFit[d, 2, {x, 10}] The '2' is just looking at the first two major waveforms. Ie (1Pi x/5, and 2 Pi x/5) We want to look at them all, so we divide your 10 points in half to get 5. equ = TrigFit[d, 5, {x, 10}] 8.01 + 3.022*Cos[(Pi*x)/5] + 2.012*Cos[(2*Pi*x)/5] + . 2.037*Sin[(Pi*x)/5] + 4.022*Sin[(2*Pi*x)/5] + ..etc Let's look at points 0-9 (not 1-10), and check that they equal our points. Table[equ, {x, 0, 9}] - d //Chop {0.01,-0.01,0.01,-0.001,0.001,-0.001,0.01,-0.01,0.01,-0.01} Hmmm. We have small errors. This Bug is still there in Version 6 !! Wolfram was informed of this bug years ago, and the suggestion was made to make it more efficient by including FourierParameters->{}. Well, they improved the function, but the the second major bug is still there. When you have an Even number of points, the last frequency is omitted from the output. Let's look at the following: fftDataAnalysis = {-1, 1}; fft = Chop[Fourier[d, FourierParameters -> fftDataAnalysis]]; MatrixForm[fft] < omitted> With an even number of points, the middle term, -0.01 is not includedd. Some people (like me) set a default FourierParameters, and hence the other bug was that all output was incorrect. This was fixed. A quick check is to look at the mean, which matches the zero frequency output. Mean[d] 8.01 Anyway, the missing -0.01 needs to be added to your equation. This is the Cosine function at 5Pi x/ 5. The imaginary part is zero, because Sin(5 Pi x/5) ->Sin(Pi x) -> 0 for all integer values of x. We add -0.01 Cos(Pi x) to the above equation. Chop[Table[equ - 0.01*Cos[Pi*x], {x, 0, 9}] - d] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} As a side note, this TrigFit can be made even better if you wish. We note that A Cos(x) + B Sin(x) can be combined into one Sin or Cos term with a new Amplitude and Phase. Example: C Sin(x-phase) I like doing it this way because there are now half as many terms. -- HTH :>) Dana DeLouis Mathematica 6.0 Having to use Mathematica 5.2 Help. Reading Mathematica 4.0 Books <ratullochjk at gmail.com> wrote in message news:fnuhg8$9sq$1 at smc.vnet.net... > Fourier Series Expansions and it's Coefficients question revised > > Greetings > > I've worked through a Fourier Series Expansion and it's Coefficients and > 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 Series > Expansions in Trigonometric form using mathematica 6. I've included an > example that I've worked through below > http://demos.onewithall.net/discrete_fourier_expansion_coefficients.jpg > > I've been through mathematica site and they have examples of > Fourier Series but the examples they have are examples of equations they > give you. I'm looking for an example where the equation isn't known and > 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.jpg > > Does an example exist? If not what are the steps needed in mathematica 6 to > accomplish this. > > Tia simple