[Date Index]
[Thread Index]
[Author Index]
Re: Extracting coefficients for sinusoidals
*To*: mathgroup at smc.vnet.net
*Subject*: [mg60497] Re: [mg60477] Extracting coefficients for sinusoidals
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Sun, 18 Sep 2005 01:15:52 -0400 (EDT)
*Reply-to*: hanlonr at cox.net
*Sender*: owner-wri-mathgroup at wolfram.com
signal=Sin[p];
f[x_]:=a1*x+a1*x^2+a1*x^3+a4*x^4+a5*x^5;
CoefficientList[(signal//f//TrigReduce)/.
{Sin[n_.*p]:>s^n,Cos[n_.*p]:>c^n},{s,c}]
{{a1/2 + (3*a4)/8, 0, -(a1/2) - a4/2, 0, a4/8},
{(7*a1)/4 + (5*a5)/8, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{-(a1/4) - (5*a5)/16, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
{a5/16, 0, 0, 0, 0}}
Bob Hanlon
>
> From: Helge Stenstrom <helge.stenstrom at ericsson.com>
To: mathgroup at smc.vnet.net
> Subject: [mg60497] [mg60477] Extracting coefficients for sinusoidals
>
> 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: Set of strings reducing problem (Again!)**
Next by Date:
**RegularExpression::maxrec: Recursion limit exceeded - positive match might be missed**
Previous by thread:
**Re: probability with simulation**
Next by thread:
**RegularExpression::maxrec: Recursion limit exceeded - positive match might be missed**
| |