[Date Index]
[Thread Index]
[Author Index]
Extracting coefficients for sinusoidals
*To*: mathgroup at smc.vnet.net
*Subject*: [mg60477] Extracting coefficients for sinusoidals
*From*: Helge Stenstrom <helge.stenstrom at ericsson.com>
*Date*: Sat, 17 Sep 2005 02:32:01 -0400 (EDT)
*Organization*: Ericsson
*Sender*: owner-wri-mathgroup at wolfram.com
Suppose I have a signal
signal = Sin[p]
and a non-linear function
f[x_] := x - x^3/3
then
f[signal] = Sin[p] - Sin[p]^3/3
but I don't want this form (with powers of the Sin function), but
rather the form with multiples of p. TrigReduce can solve that:
signal // f // TrigReduce
(9*Sin[p] + Sin[3*p])/12
It's easy to extract the coefficients by visual inspection,
9/12, 1/12
but how can it be done programmaticaly? With a more complex non-linear
function, for example
a1*x + a1*x^2 + a1*x^3 + a4*x^4 + a5*x^5
using
signal // f // TrigReduce // InputForm
resulting in
(8*a1 + 6*a4 - 8*a1*Cos[2*p] - 8*a4*Cos[2*p] + 2*a4*Cos[4*p] + 28*a1*Sin[p] +
10*a5*Sin[p] - 4*a1*Sin[3*p] - 5*a5*Sin[3*p] + a5*Sin[5*p])/16
visual ispection is no longer simple enough. So how can I get the
coefficients, individually or as a list?
I'm not sure how I want the Cos and Sin terms to be treated; probably
a*Cos[x] should correspond to a*I*Sin[x] when the coefficients are
collected.
--
Helge Stenström
Prev by Date:
**Re: number of digits in n^p**
Next by Date:
**calling a C executable from within Mathematica**
Previous by thread:
**Re: The question of equality,...**
Next by thread:
**Re: Extracting coefficients for sinusoidals**
| |