[Fwd: Fourier Series Expansions and it's Coefficients question
- To: mathgroup at smc.vnet.net
- Subject: [mg85262] [Fwd: [mg85198] Fourier Series Expansions and it's Coefficients question
- From: mante <claude.mante at univmed.fr>
- Date: Tue, 5 Feb 2008 05:54:25 -0500 (EST)
Hello, ihis solution looks like your example : y = {14, 18.7, 9, 4.1, 6.7, 6, 6.3, 8.4, 4, 2.9}; x = Range[0, Length@y]; f[z_] := Piecewise[ Table[{y[[i]], x[[i]] < z < x[[i + 1]]}, {i, Length@y}]]; T = (-First@x + Last@x); co[n_] = 2 Integrate[f[t] Cos[n 2 \[Pi] t/T], {t, First@x, Last@x}]/ T; si[n_] = 2 Integrate[f[t] Sin[n 2 \[Pi] t/T], {t, First@x, Last@x}]/ T; A0 = Integrate[f[t] , {t, First@x, Last@x}]/T; approx[t_] := A0 + Sum[co[k] Cos[k 2 \[Pi] t/T] + si[k] Sin[k 2 \[Pi] t/T], {k, 10}]; Plot[{f[t], approx[t]}, {t, First@x, Last@x}] -- ********************************* Claude Manté UMR CNRS 6117 LMGEM http://www.com.univ-mrs.fr/LMGEM/ Centre d'Océanologie de Marseille Campus de Luminy, Case 901 13288 MARSEILLE Cedex 09 tel : (+33) 491 829 127 fax : (+33) 491 829 119 !! New mail adress: !! ---------------- claude.mante at univmed.fr *********************************