|
[Date Index]
[Thread Index]
[Author Index]
Re: Extract Coefficients of Fourier Series
- To: mathgroup at smc.vnet.net
- Subject: [mg58823] Re: Extract Coefficients of Fourier Series
- From: mike_in_england2000 at yahoo.co.uk
- Date: Wed, 20 Jul 2005 00:29:21 -0400 (EDT)
- References: <dbie2e$brj$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi
In order to illustrate how I went about this I created some random data
and TrigFit returned something like this.
0.576739 + 0.128598 Cos[x] + 0.0328485
Cos[2 x] - 0.018517 Cos[3 x] + 0.0484222 Cos[4 x]
So I call this functiuon fit[x] -
fit[x_]:=0.576739 + 0.128598 Cos[x] + 0.0328485
Cos[2 x] - 0.018517 Cos[3 x] + 0.0484222 Cos[4 x]
The constant term I get by doing
const = fit[x][[1]];
the rest of the terms I get using a loop:
Do[
coeff = fit[x][[n]][[1]];
Print[coeff];
, {n, 2, Length[fit[x]]}
]
which should print out the coefficients. I'll leave it to you to
modify the loop so instead of printing them you square and add them up.
hope this helps
Mike
Prev by Date:
Re: "2p" in BenchmarkReport[] ?
Next by Date:
Re: Symbolic Constrained Maximization
Previous by thread:
Re: Extract Coefficients of Fourier Series
Next by thread:
Re: Extract Coefficients of Fourier Series
|